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

azurerm_iothub & azurerm_iothub_dps: deprecate the sku.tier property #5382

Merged
merged 5 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion azurerm/internal/services/iothub/resource_arm_iot_dps.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ As such the existing 'azurerm_iot_dps' resource is deprecated and will be remove

"tier": {
Type: schema.TypeString,
Required: true,
Optional: true,
Computed: true,
Deprecated: "This property is no longer required and will be removed in version 2.0 of the provider",
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
string(devices.Basic),
Expand Down
21 changes: 8 additions & 13 deletions azurerm/internal/services/iothub/resource_arm_iothub.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ func resourceArmIotHub() *schema.Resource {
string(devices.S1),
string(devices.S2),
string(devices.S3),
}, true),
}, true), // todo 2.0 make this case sensitive (all constants?)
},

"tier": {
Type: schema.TypeString,
Required: true,
Optional: true,
Computed: true,
Deprecated: "This property is no longer required and will be removed in version 2.0 of the provider",
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
string(devices.Basic),
Expand Down Expand Up @@ -469,8 +471,6 @@ func resourceArmIotHubCreateUpdate(d *schema.ResourceData, meta interface{}) err
}

location := azure.NormalizeLocation(d.Get("location").(string))
skuInfo := expandIoTHubSku(d)
t := d.Get("tags").(map[string]interface{})

routingProperties := devices.RoutingProperties{}

Expand Down Expand Up @@ -500,15 +500,15 @@ func resourceArmIotHubCreateUpdate(d *schema.ResourceData, meta interface{}) err
properties := devices.IotHubDescription{
Name: utils.String(name),
Location: utils.String(location),
Sku: skuInfo,
Sku: expandIoTHubSku(d),
Properties: &devices.IotHubProperties{
IPFilterRules: ipFilterRules,
Routing: &routingProperties,
StorageEndpoints: storageEndpoints,
MessagingEndpoints: messagingEndpoints,
EnableFileUploadNotifications: &enableFileUploadNotifications,
},
Tags: tags.Expand(t),
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
}

future, err := client.CreateOrUpdate(ctx, resourceGroup, name, properties, "")
Expand Down Expand Up @@ -847,15 +847,10 @@ func expandIoTHubFallbackRoute(d *schema.ResourceData) *devices.FallbackRoutePro
func expandIoTHubSku(d *schema.ResourceData) *devices.IotHubSkuInfo {
skuList := d.Get("sku").([]interface{})
skuMap := skuList[0].(map[string]interface{})
capacity := int64(skuMap["capacity"].(int))

name := skuMap["name"].(string)
tier := skuMap["tier"].(string)

return &devices.IotHubSkuInfo{
Name: devices.IotHubSku(name),
Tier: devices.IotHubSkuTier(tier),
Capacity: utils.Int64(capacity),
Name: devices.IotHubSku(skuMap["name"].(string)),
Capacity: utils.Int64(int64(skuMap["capacity"].(int))),
}
}

Expand Down
18 changes: 7 additions & 11 deletions azurerm/internal/services/iothub/resource_arm_iothub_dps.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ func resourceArmIotHubDPS() *schema.Resource {
string(devices.S1),
string(devices.S2),
string(devices.S3),
}, true),
}, true), // todo 2.0 make this case sensitive
},

"tier": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: suppress.CaseDifference,
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: "This property is no longer required and will be removed in version 2.0 of the provider",
ValidateFunc: validation.StringInSlice([]string{
string(devices.Basic),
string(devices.Free),
Expand Down Expand Up @@ -329,15 +330,10 @@ func iothubdpsStateStatusCodeRefreshFunc(ctx context.Context, client *iothub.Iot
func expandIoTHubDPSSku(d *schema.ResourceData) *iothub.IotDpsSkuInfo {
skuList := d.Get("sku").([]interface{})
skuMap := skuList[0].(map[string]interface{})
capacity := int64(skuMap["capacity"].(int))

name := skuMap["name"].(string)
tier := skuMap["tier"].(string)

return &iothub.IotDpsSkuInfo{
Name: iothub.IotDpsSku(name),
Tier: utils.String(tier),
Capacity: utils.Int64(capacity),
Name: iothub.IotDpsSku(skuMap["name"].(string)),
Capacity: utils.Int64(int64(skuMap["capacity"].(int))),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down Expand Up @@ -198,7 +197,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -191,12 +190,11 @@ func testAccAzureRMIotDPS_requiresImport(data acceptance.TestData) string {

resource "azurerm_iot_dps" "import" {
name = "${azurerm_iot_dps.test.name}"
resource_group_name = "${azurerm_iot_dps.test.name}"
resource_group_name = "${azurerm_iot_dps.test.resource_group_name}"
location = "${azurerm_iot_dps.test.location}"

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -217,7 +215,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand All @@ -242,7 +239,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -275,7 +271,6 @@ resource "azurerm_iot_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down Expand Up @@ -198,7 +197,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -128,7 +127,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -154,7 +152,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -180,7 +177,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -195,12 +194,11 @@ func testAccAzureRMIotHubDPS_requiresImport(data acceptance.TestData) string {

resource "azurerm_iothub_dps" "import" {
name = "${azurerm_iothub_dps.test.name}"
resource_group_name = "${azurerm_iothub_dps.test.name}"
resource_group_name = "${azurerm_iothub_dps.test.resource_group_name}"
location = "${azurerm_iothub_dps.test.location}"

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand All @@ -221,7 +219,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand All @@ -246,7 +243,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -279,7 +275,6 @@ resource "azurerm_iothub_dps" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -256,7 +255,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -282,7 +281,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "B1"
tier = "Basic"
capacity = "1"
}

Expand All @@ -247,7 +246,7 @@ func testAccAzureRMIotHub_requiresImport(data acceptance.TestData) string {

resource "azurerm_iothub" "import" {
name = "${azurerm_iothub.test.name}"
resource_group_name = "${azurerm_iothub.test.name}"
resource_group_name = "${azurerm_iothub.test.resource_group_name}"
location = "${azurerm_iothub.test.location}"

sku {
Expand Down Expand Up @@ -277,7 +276,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand All @@ -302,7 +300,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -371,7 +368,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -429,7 +425,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down Expand Up @@ -475,7 +470,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ resource "azurerm_iothub" "updated" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down Expand Up @@ -310,7 +309,6 @@ resource "azurerm_iothub" "test" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/iothub.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ resource "azurerm_iothub" "example" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/r/iothub_consumer_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ resource "azurerm_iothub" "example" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/r/iothub_dps.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ resource "azurerm_iothub_dps" "example" {

sku {
name = "S1"
tier = "Standard"
capacity = "1"
}
}
Expand Down
Loading