-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
value of 'count' cannot be computed with data list #18157
Comments
@jbardin Any thoughts about fixing this or a way to work around it? I've tried multiple ways to try to 'trick' terraform into counting these items including doing a length() call in the outputs of the S3 bucket module and trying to use that in the other module but I keep running into the cannot be calculated error. |
Hi @jw-maynard! Sorry for this annoying behavior, and for the slow response. It looks like this issue has the same root cause as #14677, which I verified as fixed over in #12570. This fix will be included in the forthcoming v0.12.0 final release. The crux of the problem is that Terraform v0.11 and earlier have a rule that a list containing an unknown value is simplified into a wholly-unknown list, which then in turn causes It's not entirely clear to me, to be honest, why the data source here was producing computed results in the first place: as you said, it ought to be known by the time the plan is created since the data source is dealt with during the refresh step. My guess would be that it's related to the fact that in v0.11 and prior If you are able to share a more complete configuration here I might be able to figure that out and come up with a simpler repro to verify on v0.12.0-alpha2, but at least those unknown values should become a moot point in v0.12.0 because we're removing that simplification rule so that a list with an unknown value inside of it can still itself have a known length. Since there's a fix for this in master ready to be included in the next release, I'm going to close this out. Thanks for reporting it, and sorry again for the slow response. |
@apparentlymart Thanks for taking a look. When we start migrating to 0.12 we'll have a lot of workarounds to unwind. If something like this crops up again I'll just post a new issue. Thanks again! |
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. |
Terraform Version
Terraform Configuration Files
Expected Behavior
I would expect this to be able to count the number of items it needs to create since the S3 bucket module referenced by the data object is already applied.
If I use a different S3 module that has just a single policy ARN as an output then I don't get that error. It only seems to be when the output of the module is a list.
Actual Behavior
I get the error that 'count' cannot be computed.
The text was updated successfully, but these errors were encountered: