Skip to content

Commit

Permalink
r/managed_disk: ensuring that disk_encryption_set_id is always set
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Jan 14, 2020
1 parent 74baefb commit 189508e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ func resourceArmManagedDiskRead(d *schema.ResourceData, meta interface{}) error
d.Set("disk_mbps_read_write", props.DiskMBpsReadWrite)
d.Set("os_type", props.OsType)

if encryption := props.Encryption; encryption != nil {
d.Set("disk_encryption_set_id", encryption.DiskEncryptionSetID)
diskEncryptionSetId := ""
if props.Encryption != nil && props.Encryption.DiskEncryptionSetID != nil {
diskEncryptionSetId = *props.Encryption.DiskEncryptionSetID
}
d.Set("disk_encryption_set_id", diskEncryptionSetId)

if err := d.Set("encryption_settings", flattenManagedDiskEncryptionSettings(props.EncryptionSettingsCollection)); err != nil {
return fmt.Errorf("Error setting `encryption_settings`: %+v", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ func TestAccAzureRMManagedDisk_NonStandardCasing(t *testing.T) {
CheckDestroy: testCheckAzureRMManagedDiskDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMManagedDiskNonStandardCasing(data),
Config: testAccAzureRMManagedDisk_nonStandardCasing(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMManagedDiskExists(data.ResourceName, &d, true),
),
},
{
Config: testAccAzureRMManagedDiskNonStandardCasing(data),
Config: testAccAzureRMManagedDisk_nonStandardCasing(data),
PlanOnly: true,
ExpectNonEmptyPlan: false,
},
Expand Down Expand Up @@ -616,7 +616,7 @@ resource "azurerm_managed_disk" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

func testAccAzureRMManagedDiskNonStandardCasing(data acceptance.TestData) string {
func testAccAzureRMManagedDisk_nonStandardCasing(data acceptance.TestData) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Expand Down

0 comments on commit 189508e

Please sign in to comment.