diff --git a/builtin/providers/aws/resource_aws_launch_configuration.go b/builtin/providers/aws/resource_aws_launch_configuration.go index 8a4ffee6b..a232e6bb3 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration.go +++ b/builtin/providers/aws/resource_aws_launch_configuration.go @@ -211,13 +211,6 @@ func resourceAwsLaunchConfiguration() *schema.Resource { }, }, }, - Set: func(v interface{}) int { - var buf bytes.Buffer - m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) - buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) - return hashcode.String(buf.String()) - }, }, "ephemeral_block_device": { diff --git a/builtin/providers/aws/resource_aws_launch_configuration_test.go b/builtin/providers/aws/resource_aws_launch_configuration_test.go index 8c1bde73a..c0e63de7b 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration_test.go +++ b/builtin/providers/aws/resource_aws_launch_configuration_test.go @@ -198,7 +198,6 @@ func TestAccAWSLaunchConfiguration_withEncryption(t *testing.T) { Config: testAccAWSLaunchConfigurationWithEncryption, Check: resource.ComposeTestCheckFunc( testAccCheckAWSLaunchConfigurationExists("aws_launch_configuration.baz", &conf), - testAccCheckAWSLaunchConfigurationWithEncryption(&conf), ), }, @@ -206,6 +205,34 @@ func TestAccAWSLaunchConfiguration_withEncryption(t *testing.T) { }) } +func TestAccAWSLaunchConfiguration_updateEbsBlockDevices(t *testing.T) { + var conf autoscaling.LaunchConfiguration + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLaunchConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLaunchConfigurationWithEncryption, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSLaunchConfigurationExists("aws_launch_configuration.baz", &conf), + resource.TestCheckResourceAttr( + "aws_launch_configuration.baz", "ebs_block_device.2764618555.volume_size", "9"), + ), + }, + { + Config: testAccAWSLaunchConfigurationWithEncryptionUpdated, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSLaunchConfigurationExists("aws_launch_configuration.baz", &conf), + resource.TestCheckResourceAttr( + "aws_launch_configuration.baz", "ebs_block_device.3859927736.volume_size", "10"), + ), + }, + }, + }) +} + func testAccCheckAWSLaunchConfigurationGeneratedNamePrefix( resource, prefix string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -444,6 +471,25 @@ resource "aws_launch_configuration" "baz" { } } ` + +const testAccAWSLaunchConfigurationWithEncryptionUpdated = ` +resource "aws_launch_configuration" "baz" { + image_id = "ami-5189a661" + instance_type = "t2.micro" + associate_public_ip_address = false + + root_block_device { + volume_type = "gp2" + volume_size = 11 + } + ebs_block_device { + device_name = "/dev/sdb" + volume_size = 10 + encrypted = true + } +} +` + const testAccAWSLaunchConfigurationConfig_withVpcClassicLink = ` resource "aws_vpc" "foo" { cidr_block = "10.0.0.0/16"