-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Trouble with output from a module creating aws_iam_access_key #16688
Comments
Hi @kwach! Sorry for this weird behavior. From reading the AWS provider code for the Terraform is, therefore, correctly reporting that there is no value assigned, but indeed that makes it impossible to write a conditional expression using these attributes. This will get resolved by #15605 once it's fixed, but perhaps in the mean time it could be mitigated by having that resource populate empty values for the unused attributes so that they can be resolved when not relevant. That would be a change to the AWS provider itself, which has its own repository, but a localized change there is probably easier to get done than the internal refactoring required for #15605. |
Possibly related: hashicorp/terraform-provider-aws#2350 |
Along with the change in #15605 that would cause the error to be hidden, handling of this should be smoother once we've finished integrating the new version of the configuration language since Terraform Core will have access to the resource schema so it will know that these attributes exist even if the provider doesn't actually set them, and so they will be treated as a The new configuration language integration is already in progress, but it'll take a few iterations before Terraform Core is totally aware of the new model and can make use of the schema in this particular location. The new language version will also be the fix for #15605, so this issue should be fixed (by allowing the use of the conditional operator to select the appropriate attribute) when either one of those changes is made. |
Hi @kwach! I'm pleased to report that the various fixes I discussed here have now landed in master, ready for inclusion in the forthcoming v0.12.0 release. The conditional operator no longer reports errors in the unchosen result expression (#15605) and also any declared attribute that the provider doesn't populate with a value will now evaluate to Thanks for reporting this! |
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. |
Hi there,
I have an issue with fixing a module that creates aws_iam_access_key and tries to output keys depending on whether gpg key was passed as an input or not.
Terraform Version
Terraform Configuration Files
and a module:
Expected Behavior
No error
Actual Behavior
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform init
terraform apply
Important Factoids
There is more to it.
When I change
count=0
tocount=1
the issue persists.Error like this is displayed:
It seems I can't find a way to make it working unless only one branch of
if
is evaluated.Funnies thing is that with i.e. aws_instance I can make it work just OK. There are no properties I can't use the idiom on.
References
A bit related to:
The text was updated successfully, but these errors were encountered: