Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Resource/Data Source: azurerm_databox_edge_order and azurerm_databox_edge_device #10392

Closed
wants to merge 14 commits into from
Closed
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var services = mapOf(
"datashare" to "Data Share",
"databricks" to "DataBricks",
"databasemigration" to "Database Migration",
"databoxedge" to "Databox Edge",
"desktopvirtualization" to "Desktop Virtualization",
"devtestlabs" to "Dev Test",
"digitaltwins" to "Digital Twins",
Expand Down
3 changes: 3 additions & 0 deletions azurerm/internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
costmanagement "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/costmanagement/client"
customproviders "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/customproviders/client"
datamigration "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databasemigration/client"
databoxedge "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databoxedge/client"
databricks "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databricks/client"
datafactory "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory/client"
datalake "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datalake/client"
Expand Down Expand Up @@ -123,6 +124,7 @@ type Client struct {
CustomProviders *customproviders.Client
DatabaseMigration *datamigration.Client
DataBricks *databricks.Client
DataboxEdge *databoxedge.Client
DataFactory *datafactory.Client
Datalake *datalake.Client
DataShare *datashare.Client
Expand Down Expand Up @@ -220,6 +222,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.CustomProviders = customproviders.NewClient(o)
client.DatabaseMigration = datamigration.NewClient(o)
client.DataBricks = databricks.NewClient(o)
client.DataboxEdge = databoxedge.NewClient(o)
client.DataFactory = datafactory.NewClient(o)
client.Datalake = datalake.NewClient(o)
client.DataShare = datashare.NewClient(o)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/costmanagement"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/customproviders"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databasemigration"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databoxedge"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databricks"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datafactory"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/datalake"
Expand Down Expand Up @@ -121,6 +122,7 @@ func SupportedUntypedServices() []sdk.UntypedServiceRegistration {
cosmos.Registration{},
costmanagement.Registration{},
customproviders.Registration{},
databoxedge.Registration{},
databricks.Registration{},
datafactory.Registration{},
datalake.Registration{},
Expand Down
24 changes: 24 additions & 0 deletions azurerm/internal/services/databoxedge/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2019-08-01/databoxedge"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

type Client struct {
DeviceClient *databoxedge.DevicesClient
OrderClient *databoxedge.OrdersClient
}

func NewClient(o *common.ClientOptions) *Client {
deviceClient := databoxedge.NewDevicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&deviceClient.Client, o.ResourceManagerAuthorizer)

orderClient := databoxedge.NewOrdersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&orderClient.Client, o.ResourceManagerAuthorizer)

return &Client{
DeviceClient: &deviceClient,
OrderClient: &orderClient,
}
}
21 changes: 21 additions & 0 deletions azurerm/internal/services/databoxedge/customizediff.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package databoxedge

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/databoxedge/validate"
)

func databoxEdgeCustomizeDiff(d *schema.ResourceDiff, v interface{}) error {
if value, ok := d.GetOk("shipping_info"); ok {
shippingInfo := (value.([]interface{}))[0].(map[string]interface{})

_, err := validate.DataboxEdgeStreetAddress(shippingInfo["address"].([]interface{}), "address")
if err != nil {
return fmt.Errorf("%s", err)
}
}

return nil
}
Loading