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

API of iothub/mgmt upgraded to 2021-03-31 #13324

Merged
merged 7 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-azurerm

require (
cloud.google.com/go/storage v1.16.0 // indirect
github.com/Azure/azure-sdk-for-go v57.0.0+incompatible
github.com/Azure/azure-sdk-for-go v57.4.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.19
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/to v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v51.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v56.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v57.0.0+incompatible h1:isVki3PbIFrwKvKdVP1byxo73/pt+Nn174YxW1k4PNw=
github.com/Azure/azure-sdk-for-go v57.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v57.4.0+incompatible h1:uzhy/mTwu4rq6Be/fJJnE82PRx2A2vjGjzsA3aQ6Qu0=
github.com/Azure/azure-sdk-for-go v57.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
Expand Down
2 changes: 1 addition & 1 deletion internal/services/iothub/client/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/Azure/azure-sdk-for-go/services/provisioningservices/mgmt/2018-01-22/iothub"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
Expand Down
15 changes: 14 additions & 1 deletion internal/services/iothub/iothub_consumer_group_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -85,7 +86,19 @@ func resourceIotHubConsumerGroupCreate(d *pluginsdk.ResourceData, meta interface
}
}

if _, err := client.CreateEventHubConsumerGroup(ctx, id.ResourceGroup, id.IotHubName, id.EventHubEndpointName, id.Name); err != nil {
consumerGroupBody := devices.EventHubConsumerGroupBodyDescription{
// The properties are currently undocumented. See also:
// https://docs.microsoft.com/en-us/azure/templates/microsoft.devices/2021-03-31/iothubs/eventhubendpoints/consumergroups?tabs=json#eventhubconsumergroupname
//
// There is an example where the name is repeated in the properties,
// so that seems to be the "proper" way. See also:
// https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.devices/iothub-with-consumergroup-create/azuredeploy.json#L74
Properties: &devices.EventHubConsumerGroupName{
Name: &id.Name,
},
}

if _, err := client.CreateEventHubConsumerGroup(ctx, id.ResourceGroup, id.IotHubName, id.EventHubEndpointName, id.Name, consumerGroupBody); err != nil {
return fmt.Errorf("creating %s: %+v", id, err)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/services/iothub/iothub_dps_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/Azure/azure-sdk-for-go/services/provisioningservices/mgmt/2018-01-22/iothub"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
Expand Down Expand Up @@ -66,7 +66,7 @@ func resourceIotHubDPS() *pluginsdk.Resource {
Required: true,
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
string(devices.S1),
string(devices.IotHubSkuS1),
}, false),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -98,9 +98,9 @@ func resourceIotHubEndpointStorageContainer() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
string(devices.Avro),
string(devices.AvroDeflate),
string(devices.JSON),
string(devices.EncodingAvro),
string(devices.EncodingAvroDeflate),
string(devices.EncodingJSON),
}, true),
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/services/iothub/iothub_enrichment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
Expand Down
32 changes: 16 additions & 16 deletions internal/services/iothub/iothub_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
Expand Down Expand Up @@ -92,13 +92,13 @@ func resourceIotHub() *pluginsdk.Resource {
Required: true,
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
string(devices.B1),
string(devices.B2),
string(devices.B3),
string(devices.F1),
string(devices.S1),
string(devices.S2),
string(devices.S3),
string(devices.IotHubSkuB1),
string(devices.IotHubSkuB2),
string(devices.IotHubSkuB3),
string(devices.IotHubSkuF1),
string(devices.IotHubSkuS1),
string(devices.IotHubSkuS2),
string(devices.IotHubSkuS3),
}, false),
},

Expand Down Expand Up @@ -278,9 +278,9 @@ func resourceIotHub() *pluginsdk.Resource {
suppressIfTypeIsNot("AzureIotHub.StorageContainer"),
suppress.CaseDifference),
ValidateFunc: validation.StringInSlice([]string{
string(devices.Avro),
string(devices.AvroDeflate),
string(devices.JSON),
string(devices.EncodingAvro),
string(devices.EncodingAvroDeflate),
string(devices.EncodingJSON),
}, true),
},

Expand Down Expand Up @@ -441,8 +441,8 @@ func resourceIotHub() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(devices.Accept),
string(devices.Reject),
string(devices.IPFilterActionTypeAccept),
string(devices.IPFilterActionTypeReject),
}, false),
},
},
Expand Down Expand Up @@ -572,9 +572,9 @@ func resourceIotHubCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) err

// nolint staticcheck
if v, ok := d.GetOkExists("public_network_access_enabled"); ok {
enabled := devices.Disabled
enabled := devices.PublicNetworkAccessDisabled
if v.(bool) {
enabled = devices.Enabled
enabled = devices.PublicNetworkAccessEnabled
}
props.Properties.PublicNetworkAccess = enabled
}
Expand Down Expand Up @@ -703,7 +703,7 @@ func resourceIotHubRead(d *pluginsdk.ResourceData, meta interface{}) error {
}

if enabled := properties.PublicNetworkAccess; enabled != "" {
d.Set("public_network_access_enabled", enabled == devices.Enabled)
d.Set("public_network_access_enabled", enabled == devices.PublicNetworkAccessEnabled)
}

d.Set("min_tls_version", properties.MinTLSVersion)
Expand Down
6 changes: 2 additions & 4 deletions internal/services/iothub/iothub_route_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -61,9 +61,7 @@ func resourceIotHubRoute() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
// TODO: This string should be fetched from the Azure Go SDK, when it is updated
// string(devices.RoutingSourceDeviceConnectionStateEvents),
"DeviceConnectionStateEvents",
string(devices.RoutingSourceDeviceConnectionStateEvents),
string(devices.RoutingSourceDeviceJobLifecycleEvents),
string(devices.RoutingSourceDeviceLifecycleEvents),
string(devices.RoutingSourceDeviceMessages),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices"
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-03-31/devices"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading