Open dylan-pvt opened 3 weeks ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @dylan-pvt 👋 Thank you for taking the time to raise this! Something similar was noticed in #39296 and resulted in a change implemented by #39328. There are some recommendations in the comments there about handling some of this via a dynamic
block. One difference I noted is that it seems you're attempting to instantiate one instance of the provider by using the output of a resource created by another instantiation of the provider in the same configuration. Truthfully, I'm surprised to hear that ever worked, so it's unclear to me if that will work with these workarounds, but I would be interested to hear if it does.
This situation is exactly what deferred actions was built to support.
I didn't realize dynamic
blocks were supported in provider configs. I guess you're saying something like this ought to work?
provider "aws" {
dynamic "assume_role" {
for_each = var.aws_assume_role_arn != null ? [var.aws_assume_role_arn] : []
content {
role_arn = assume_role.value
}
}
}
variable "aws_assume_role_arn" {
description = "ARN of the role to assume for the AWS provider"
type = string
default = null
}
Terraform Core Version
1.9.7
AWS Provider Version
5.70.0
Affected Resource(s)
All
Expected Behavior
Before provider version 5.67, it was possible to have an unknown variable (output for a ressource for example) for the role_arn argument in provider assume_role configuration without having warning for provider with single assume_role. With the new feature for provider IAM role chaining, this is an error.
Actual Behavior
Provider IAM role chaining with an unknown variable for the role_arn argument results in error and fails to plan.
Since provider version 5.67, there is also a warning with unknown variable for the role_arn for a single assume_role.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
providers.tf
main.tf
Steps to Reproduce
Run the above configuration
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None