Terraform: Terraform translating true/false to 1/0 when AWS want the string value

Created on 19 Dec 2016  ยท  7Comments  ยท  Source: hashicorp/terraform

When applying an aws_lb_sll_negotiation_policy terraform converts the attribute values of true or false to a 1 or 0 which then cause the following error message:

* aws_lb_ssl_negotiation_policy.tls_policy: Error creating Load Balancer Policy: ValidationError: Policy attribute value must be "true" or "false", case insensitive

Terraform Version

0.8.0

Affected Resource(s)

aws_lb_ssl_negotiation_policy

Terraform Configuration Files

https://gist.github.com/sysadmiral/f5781b8803e42b3bb338410e5c84fb77

Expected Behavior

The lb ssl policy is applied with the correct true/false values

Actual Behavior

The apply errored because terraform validation or AWS api requires "true" or "false" (case insensitive) not a 1 or 0.

In the gist I have pasted what terraform is trying to do...

Steps to Reproduce

Create an ELB resource and try adding the config in the gist so it get's added to the ELB.
Run terraform apply.

bug config

Most helpful comment

Hi @sysadmiral! Sorry for the long silence here.

We eventually figured out what was going on here in #13512, and this issue has been fixed in Terraform 0.12.0. Thanks for reporting this, and sorry again for the long silence.

All 7 comments

This config is in an ELB module and I've checked other instantiations and they have applied the true/false values correctly although that state was created prior to 0.8.0 suggesting it's an issue with 0.8.0 and that terraform is fine with it being in state with the true/false values...

Hi @sysadmiral,

I'm not able to reproduce this with the config provided. How are the bool values stored in your current state file?

I also see that attribute only hashes by name, so attribute changes in the config aren't being detected or applied. I'm not sure I understand your comment about the state file, but is that possibly related to your issue?

This was a new environment so there was no state file. In another environment however which calls the same ELB module the state has the values as true or false but they were originally generated in an older version of terraform.

The terraform config is roughly laid out as such:

main.tf
\__calls module app
   \__calls module elb

module_elb
\__resource "aws_elb" {}
\__resource "aws_lb_ssl_negotiation_policy" {}

@sysadmiral,

Considering this is a fresh config with no state, I can't see any reason you would be getting "0" or "1" from the apply. Copy&pasting your config exactly as written works with v0.8.0 and newer.

Are you certain you are executing the correct version of terraform, and that you don't have an old terraform-provider-aws binary in your path?

I am sure of the terraform version I am using.

I have another fresh deploy of this module to do so I will test it and advise of the outcome.

Hi @sysadmiral! Sorry for the long silence here.

We eventually figured out what was going on here in #13512, and this issue has been fixed in Terraform 0.12.0. Thanks for reporting this, and sorry again for the long silence.

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rjinski picture rjinski  ยท  3Comments

thebenwaters picture thebenwaters  ยท  3Comments

ketzacoatl picture ketzacoatl  ยท  3Comments

carl-youngblood picture carl-youngblood  ยท  3Comments

franklinwise picture franklinwise  ยท  3Comments