- Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Closed
Copy link
Labels
Milestone
Description
Terraform Version
Terraform v1.6.0 on windows_amd64Affected Pages
https://developer.hashicorp.com/terraform/language/settings/backends/s3
What is the docs issue?
The example
terraform { backend "s3" { bucket = "terraform-state-prod" key = "network/terraform.tfstate" region = "us-east-1" assume_role { role_arn = "arn:aws:iam::PRODUCTION-ACCOUNT-ID:role/Terraform" } } }doesn't work:
> terraform init Initializing the backend... │ Error: Unsupported block type │ │ on test.tf line 71, in terraform: │ 71: assume_role { │ │ Blocks of type "assume_role" are not expected here. Did you mean to define argument "assume_role"? If so, use the equals sign to assign it a value. Proposal
assume_role is implemented as an argument (it is also described as an argument in the documentation), not a block, so the example must be changed to add an = after assume_role
terraform { backend "s3" { bucket = "terraform-state-prod" key = "network/terraform.tfstate" region = "us-east-1" assume_role = { role_arn = "arn:aws:iam::PRODUCTION-ACCOUNT-ID:role/Terraform" } } }References
See #30495
Note that the choice to use an argument instead a block is not consistent with the aws provider which use a block for assume_role. So it can be really confusing while the objective of #30495 was to avoid discrepancy between the aws provider and the s3 backend.
Even in #30495 description, the intention was to add assume_role as a block, not an argument.
In the light of theses elements i wonder if the implementation with an argument is volunteer or a mistake ?
luchees, msebire, theyoungones2 and mars64