-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Document value of 'count' cannot be computed
Terraform errors
#131
Comments
value of 'count' cannot be computed
Terraform errors
Document possible workaround suggested by @maartenvanderhoef https://sweetops.slack.com/archives/CB6GHNLG0/p1533834243000311 For terraformers, who like dirty hacks, and who are encountering issues with count.index inside a conditionally created resource with count to length(var.of_a_list).. here's something that worked for me 😎 create a data "template_file" with count of the length of the list with no conditions.
|
hashicorp/terraform#12570 (comment)
|
New issue related to this one: |
what
counts
inmaps
why
Terraform (in the current incarnation) is very sensitive to these two things:
counts
across modules - when you have a dynamic count (calculated by some expression with input params) in one module and then use the module from other modulescounts
inmaps
andlists
Some know issues about that:
hashicorp/terraform#13980
hashicorp/terraform#10857
hashicorp/terraform#12570
hashicorp/terraform#17048
In our case:
Here the
count
depends on themap
and the inputvar.tags
https://github.com/cloudposse/terraform-null-label/blob/master/main.tf#L23
And here
var.tags
depends on themap
, the other inputs and on thedata
providerhttps://github.com/cloudposse/terraform-aws-ec2-instance/blob/master/main.tf#L68
This circular dependency breaks TF.
It’s very difficult to say for sure what’s going on, because it could work in some cases and in some environments, but not in the others.
(see the complains above).
I know this is not a good explanation, but they have been discussing the issue for years and can’t explain it eigher.
Because nobody understands it.
The fix:
maps
fromcounts
data
source (could work in some cases)apply
in stages with-target
(not a pretty solution)The text was updated successfully, but these errors were encountered: