Skip to content

Terraform 1.6.0 - Backend s3 new assume_role argument example is incorrect #33994

@xfournet

Description

@xfournet

Terraform Version

Terraform v1.6.0 on windows_amd64

Affected 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 ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions