Skip to content

Commit

Permalink
Update azurerm_linux|windows_virtual_machine_scale_set - change ext…
Browse files Browse the repository at this point in the history
…ension block from List to Set (hashicorp#11425)
  • Loading branch information
ArcturusZhang authored and favoretti committed May 26, 2021
1 parent 5828672 commit 2b80d91
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@ func TestAccLinuxVirtualMachineScaleSet_otherEncryptionAtHost(t *testing.T) {
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -523,24 +522,21 @@ func TestAccLinuxVirtualMachineScaleSet_otherEncryptionAtHostUpdate(t *testing.T
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
{
Config: r.otherEncryptionAtHost(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
{
Config: r.otherEncryptionAtHost(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -555,8 +551,7 @@ func TestAccLinuxVirtualMachineScaleSet_otherEncryptionAtHostWithCMK(t *testing.
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -571,8 +566,7 @@ func TestAccLinuxVirtualMachineScaleSet_otherPlatformFaultDomainCount(t *testing
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *schema.ResourceData, meta inte

hasHealthExtension := false
if vmExtensionsRaw, ok := d.GetOk("extension"); ok {
virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.([]interface{}))
virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.(*schema.Set).List())
if err != nil {
return err
}
Expand Down Expand Up @@ -824,7 +824,7 @@ func resourceLinuxVirtualMachineScaleSetUpdate(d *schema.ResourceData, meta inte
if d.HasChanges("extension", "extensions_time_budget") {
updateInstances = true

extensionProfile, _, err := expandVirtualMachineScaleSetExtensions(d.Get("extension").([]interface{}))
extensionProfile, _, err := expandVirtualMachineScaleSetExtensions(d.Get("extension").(*schema.Set).List())
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ func FlattenVirtualMachineScaleSetAutomaticRepairsPolicy(input *compute.Automati

func VirtualMachineScaleSetExtensionsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@ func TestAccWindowsVirtualMachineScaleSet_otherEncryptionAtHostEnabled(t *testin
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -629,24 +628,21 @@ func TestAccWindowsVirtualMachineScaleSet_otherEncryptionAtHostEnabledUpdate(t *
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
{
Config: r.otherEncryptionAtHostEnabled(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
{
Config: r.otherEncryptionAtHostEnabled(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -661,8 +657,7 @@ func TestAccWindowsVirtualMachineScaleSet_otherEncryptionAtHostEnabledWithCMK(t
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand All @@ -677,8 +672,7 @@ func TestAccWindowsVirtualMachineScaleSet_otherPlatformFaultDomainCount(t *testi
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// TODO - extension should be changed to extension.0.protected_settings when either binary testing is available or this feature is promoted from beta
data.ImportStep("admin_password", "extension"),
data.ImportStep("admin_password", "extension.0.protected_settings"),
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func resourceWindowsVirtualMachineScaleSetCreate(d *schema.ResourceData, meta in

hasHealthExtension := false
if vmExtensionsRaw, ok := d.GetOk("extension"); ok {
virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.([]interface{}))
virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.(*schema.Set).List())
if err != nil {
return err
}
Expand Down Expand Up @@ -851,7 +851,7 @@ func resourceWindowsVirtualMachineScaleSetUpdate(d *schema.ResourceData, meta in
if d.HasChanges("extension", "extensions_time_budget") {
updateInstances = true

extensionProfile, _, err := expandVirtualMachineScaleSetExtensions(d.Get("extension").([]interface{}))
extensionProfile, _, err := expandVirtualMachineScaleSetExtensions(d.Get("extension").(*schema.Set).List())
if err != nil {
return err
}
Expand Down

0 comments on commit 2b80d91

Please sign in to comment.