-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
resource/aws_launch_template: Prevent encrypted flag cannot be specified error with block_device_mappings ebs argument #5632
Conversation
…ied error with block_device_mappings ebs argument * Convert `block_device_mappings` > `ebs` > `delete_on_termination` and `encrypted` to `schema.TypeString`. This to allow an "unspecified" value for the attributes since `schema.TypeBool` only has true/false with false default. The conversion from bare true/false values in configurations to `schema.TypeString` value is currently safe. Previously: ``` --- FAIL: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (11.23s) testing.go:527: Step 0 error: Error applying: 1 error occurred: * aws_autoscaling_group.test: 1 error occurred: * aws_autoscaling_group.test: Error creating AutoScaling Group: ValidationError: You must use a valid fully-formed launch template. the encrypted flag cannot be specified since device /dev/sda1 has a snapshot specified. ``` After code adjustments: ``` make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchTemplate_ -timeout 120m === RUN TestAccAWSLaunchTemplate_importBasic --- PASS: TestAccAWSLaunchTemplate_importBasic (13.63s) === RUN TestAccAWSLaunchTemplate_importData --- PASS: TestAccAWSLaunchTemplate_importData (12.00s) === RUN TestAccAWSLaunchTemplate_basic --- PASS: TestAccAWSLaunchTemplate_basic (12.71s) === RUN TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (48.73s) === RUN TestAccAWSLaunchTemplate_data --- PASS: TestAccAWSLaunchTemplate_data (13.59s) === RUN TestAccAWSLaunchTemplate_update --- PASS: TestAccAWSLaunchTemplate_update (46.88s) === RUN TestAccAWSLaunchTemplate_tags --- PASS: TestAccAWSLaunchTemplate_tags (21.37s) === RUN TestAccAWSLaunchTemplate_nonBurstable --- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.47s) === RUN TestAccAWSLaunchTemplate_networkInterface --- PASS: TestAccAWSLaunchTemplate_networkInterface (30.44s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 211.533s ```
… with TypeString boolean attributes Previously: ``` --- FAIL: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (1.27s) testing.go:527: Step 0 error: config is invalid: aws_launch_template.test: expected block_device_mappings.0.ebs.0.delete_on_termination to be one of [ false true], got 1 ``` Now: ``` make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchTemplate_ -timeout 120m === RUN TestAccAWSLaunchTemplate_importBasic --- PASS: TestAccAWSLaunchTemplate_importBasic (13.71s) === RUN TestAccAWSLaunchTemplate_importData --- PASS: TestAccAWSLaunchTemplate_importData (11.56s) === RUN TestAccAWSLaunchTemplate_basic --- PASS: TestAccAWSLaunchTemplate_basic (12.18s) === RUN TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (48.61s) === RUN TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (48.98s) === RUN TestAccAWSLaunchTemplate_data --- PASS: TestAccAWSLaunchTemplate_data (11.61s) === RUN TestAccAWSLaunchTemplate_update --- PASS: TestAccAWSLaunchTemplate_update (54.26s) === RUN TestAccAWSLaunchTemplate_tags --- PASS: TestAccAWSLaunchTemplate_tags (20.58s) === RUN TestAccAWSLaunchTemplate_nonBurstable --- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.58s) === RUN TestAccAWSLaunchTemplate_networkInterface --- PASS: TestAccAWSLaunchTemplate_networkInterface (30.64s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 264.442s ```
c79ee01
to
2e8a2b3
Compare
Adding an acceptance test that attempted to set one of these to Previously:
Now:
Since we're all green -- merging! |
This has been released in version 1.34.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #4553
Fixes #4774
Closes #4620
Previously:
Changes proposed in this pull request:
block_device_mappings
>ebs
>delete_on_termination
andencrypted
toschema.TypeString
. This to allow an "unspecified" value for the attributes sinceschema.TypeBool
only has true/false with false default. The conversion from bare true/false values in configurations toschema.TypeString
value is currently safe.Output from acceptance testing: