hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
43.16k stars 9.58k forks source link

Incorrect Behavior: terraform_remote_state potentially missing arguments #36152

Open arundhingra opened 1 day ago

arundhingra commented 1 day ago

Terraform Version

Terraform v1.10.0
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.79.0

Terraform Configuration Files

data "terraform_remote_state" "remote_state" {
  backend = "s3"

  config = {
    bucket   = "state_bucket"
    encrypt  = true
    key      = "terraform.tfstate"
    region   = "us-east-1"
  }

  assume_role = {
    role_arn = "arn:aws:iam::0000000000:role/state-role"
  }
}

Debug Output

n/a

Expected Behavior

Terraform should apply successfully

Actual Behavior

Terraform did not apply successfully

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

The role_arn field was deprecated from the S3 backend config block, and the functionality removed in terraform version 1.10. It is recommended to instead use the assume_role block (docs).

However, the assume_role block is not supported for the terraform_remote_state data source (docs).

References

https://github.com/hashicorp/terraform/pull/35721

jbardin commented 1 day ago

Hi @arundhingra,

The terraform_remote_state data source only has a config attribute for configuration, because that object contains the entire configuration for the backend being used. Does it work if you add assume_role into the config object?