hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.11k forks source link

[Enhancement]: Skip ARN validation in provider #39471

Open juallaix opened 4 days ago

juallaix commented 4 days ago

Description

The Terraform provider is too restrictive regarding ARN validation. It forbids the use of custom ARN for third-party tools. A property like skip_arn_validation in the provider would solve the problem.

provider "aws" {
  alias = "s5"

  skip_requesting_account_id  = true
  skip_region_validation = true

  assume_role_with_web_identity {
    role_arn                = "arn:custom:iam::29065fb9-1b2e-403a-8682-463837e168a7:root"
    session_name            = "rootSession"
    web_identity_token = data.external.root_account_auto_token.result.access_token
  }

  endpoints {
    sts = "https://${var.customer}.sts.astran.io"
    iam = "https://${var.customer}.iam.astran.io"
  }
}

The following errors occur:

Error: "assume_role_with_web_identity.0.role_arn" (arn:custom:iam::29065fb9-1b2e-403a-8682-463837e168a7:root) is an invalid ARN: invalid partition value (expecting to match regular expression: ^aws(-[a-z]+)*$)

Error: "assume_role_with_web_identity.0.role_arn" (arn:custom:iam::29065fb9-1b2e-403a-8682-463837e168a7:root) is an invalid ARN: invalid account ID value (expecting to match regular expression: ^(aws|aws-managed|third-party|\d{12}|cw.{10})$)

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

provider "aws" {
  alias = "s5"

  skip_requesting_account_id  = true
  skip_region_validation = true
  #skip_arn_validation = true

  assume_role_with_web_identity {
    role_arn                = "arn:custom:iam::29065fb9-1b2e-403a-8682-463837e168a7:root"
    session_name            = "rootSession"
    web_identity_token = data.external.root_account_auto_token.result.access_token
  }

  endpoints {
    sts = "https://${var.customer}.sts.astran.io"
    iam = "https://${var.customer}.iam.astran.io"
  }
}

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue