Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to pass external id when using aws_assume_role_arn #346

Open
senthilvael opened this issue Mar 27, 2023 · 3 comments
Open

Option to pass external id when using aws_assume_role_arn #346

senthilvael opened this issue Mar 27, 2023 · 3 comments

Comments

@senthilvael
Copy link

Hi Team,
We are using the "phillbaker/elasticsearch" module in our TF code. Our pipeline and the terraform execution role are in 2 different aws accounts. When we pass the aws_assume_role_arn, we are getting an access denied error. As the terraform-privilaged role is having an external id in the sts policy. If we remove that external id condition in the sts policy, the code works as expected.

terraform
provider "elasticsearch" {
  healthcheck = false
  sniff       = false
  url         = "https://${module.dev_logs.elasticsearch.endpoint}"
  aws_assume_role_arn = "arn:aws:iam::${var.AWS_ACCOUNT_ID}:role/terraform-privilaged"

Error

"errorCode": "AccessDenied",
    "errorMessage": "User: arn:aws:sts::<PIPE_LINE_AWS>:assumed-role/gitlab-runner/1679911173656119075 is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::<CLUSTER_RESIDING_AWS>:role/terraform-privilaged",

Is there a way to pass the external id in the provider.tf? Like the aws provider?

terraform
provider "aws" {
  region = "us-east-2"

  assume_role {
    role_arn    = "arn:aws:iam::${var.AWS_ACCOUNT_ID}:role/terraform-privilaged"
    external_id = var.EXTERNAL_ID
  }
}
@phillbaker
Copy link
Owner

Can you link to upstream AWS regarding the external ID? Are other providers also using this identifier?

@phillbaker
Copy link
Owner

@9rnt
Copy link
Contributor

9rnt commented Jul 12, 2023

Any updates on this feature ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants