You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately yes it is intentional -- though annoying, I agree -- that you can't reference resource attributes in count. The reason for this is that count needs to be handed during planning, which means that some resources may not have been created yet.
We're working on a new concept called "data sources" over in #4169 which represents the kind of thing template_file is: loading or computing some data to use elsewhere in the configuration, rather than creating and managing a resource. The intent is that template_file would become a data source in future, and would then be permitted to be used in count since its result would be known during planning.
#4961 is where the work for this feature is currently being done, with the intent that it be included in the 0.7 release of Terraform.
For now I'm going to close this issue since I think it's covered by these other tickets. Thanks for the ticket and I'm sorry I don't have a good workaround for you right now.
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.
I am using a template resource to construct a complex list of cidr ranges and want to use it to create the count parameter as shown below.
count = "${length(split(",", template_file.test.rendered))}"
This returns the following error:
resource count can't reference resource variable: template_file.test.rendered
Is this by design that you can't reference a template_file rendering in the count parameter?
Thanks!
The text was updated successfully, but these errors were encountered: