_This issue was originally opened by @cjbottaro as hashicorp/terraform#18605. It was migrated here as a result of the provider split. The original body of the issue is below._
$ terraform -v
Terraform v0.11.7
+ provider.aws v1.30.0
Setting
ebs_optimized = false
for an aws_launch_template resource should set EBS optimized to false in AWS.
See screenshot of plan:
http://storage.stochasticbytes.com.s3.amazonaws.com/CKzjSoHv.png
EBS optimized is set to "not specified" in AWS:
http://storage.stochasticbytes.com.s3.amazonaws.com/m5b1nDN6.png
I can confirm that, TF treats false the same as null and it's more than just that one parameter in this resource.
aws_launch_template uses GetOk() which treats false the same as null. I think it should be changed to GetOkExists() but haven't quite figured it out yet.
aws_launch_template uses GetOk() which treats false the same as null. I think it should be changed to GetOkExists() but haven't quite figured it out yet.
In addition to this, in the schema ebs_optimized is Optional, with no Default value, so when it's removed Terraform doesn't care because it's optional to begin with. We should add a default that matches what AWS defaults this value to.
@catsby Do you know of any place where something similar was done? I tried looking into this one but it's not as trivial as I thought it will be.
EC2 Launch Templates are pretty odd and can actually have three states for "boolean" attributes:
false: override AMI setting to disable on launching instance true: override AMI setting to enable on launching instance We need to be careful if we are assigning defaults in this resource as most/all(?) should not have a default so they match the "unspecified" case. Understandably this is a little difficult in Terraform's schema definitions as TypeBool has an implicit default value of false.
The fix for this has been merged into master and will release with version 1.36.0 of the AWS provider, likely middle of next week. 👍
This has been released in version 1.36.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!