unfunco / terraform-aws-oidc-github

Terraform module to configure GitHub Actions as an IAM OIDC identity provider in AWS.
https://registry.terraform.io/modules/unfunco/oidc-github/aws/latest
Apache License 2.0
91 stars 51 forks source link

output role_arn is incompatible with aws_iam_role_policy_attachment resource #36

Closed AlexanderStout closed 11 months ago

AlexanderStout commented 11 months ago

Issue

aws_iam_role_policy_attachment requires role name, not arn. in order to attach a policy to the created role "github", either arn string manipulation is needed or hard-coding "github"

Example

` module "oidc_github" { source = "unfunco/oidc-github/aws" version = "1.5.2"

github_repositories = ["org/repo"] }

resource "aws_iam_role_policy_attachment" "github_role_ecr_policy_attachement" { role = "github" policy_arn = aws_iam_policy.ecr_push_policy.arn }`

Proposed solution:

add role_name output which will consist only of role name