Skip to content

Commit

Permalink
chore: added examples for oidc with trusted roles
Browse files Browse the repository at this point in the history
  • Loading branch information
aacuadras committed Aug 22, 2024
1 parent 810c3a8 commit a0e58a5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/iam-assumable-role-with-oidc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ No providers.
| <a name="module_iam_assumable_role_inline_policy"></a> [iam\_assumable\_role\_inline\_policy](#module\_iam\_assumable\_role\_inline\_policy) | ../../modules/iam-assumable-role-with-oidc | n/a |
| <a name="module_iam_assumable_role_provider_trust_policy_conditions"></a> [iam\_assumable\_role\_provider\_trust\_policy\_conditions](#module\_iam\_assumable\_role\_provider\_trust\_policy\_conditions) | ../../modules/iam-assumable-role-with-oidc | n/a |
| <a name="module_iam_assumable_role_self_assume"></a> [iam\_assumable\_role\_self\_assume](#module\_iam\_assumable\_role\_self\_assume) | ../../modules/iam-assumable-role-with-oidc | n/a |
| <a name="module_iam_assumable_role_with_trusted_actions"></a> [iam\_assumable\_role\_with\_trusted\_actions](#module\_iam\_assumable\_role\_with\_trusted\_actions) | ../../modules/iam-assumable-role-with-oidc | n/a |
| <a name="module_iam_assumable_role_with_trusted_roles"></a> [iam\_assumable\_role\_with\_trusted\_roles](#module\_iam\_assumable\_role\_with\_trusted\_roles) | ../../modules/iam-assumable-role-with-oidc | n/a |

## Resources

Expand Down
54 changes: 54 additions & 0 deletions examples/iam-assumable-role-with-oidc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,57 @@ module "iam_assumable_role_provider_trust_policy_conditions" {
}
]
}

#####################################
# IAM assumable role with trusted role
#####################################
module "iam_assumable_role_with_trusted_roles" {
source = "../../modules/iam-assumable-role-with-oidc"

create_role = true
role_name = "role-with-trusted-roles"

tags = {
Role = "role-with-trusted-roles"
}

provider_url = "oidc.circleci.com/org/<CIRCLECI_ORG_UUID>"
oidc_fully_qualified_audiences = ["<CIRCLECI_ORG_UUID>"]

trusted_role_arns = [
"arn:aws:iam::307990089504:root",
]

role_policy_arns = [
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser",
]
}

#####################################
# IAM assumable role with trusted role
#####################################
module "iam_assumable_role_with_trusted_actions" {
source = "../../modules/iam-assumable-role-with-oidc"

create_role = true
role_name = "role-with-trusted-actions"

tags = {
Role = "role-with-trusted-actions"
}

provider_url = "oidc.circleci.com/org/<CIRCLECI_ORG_UUID>"
oidc_fully_qualified_audiences = ["<CIRCLECI_ORG_UUID>"]

trusted_role_arns = [
"arn:aws:iam::307990089504:root",
]

trusted_role_actions = [
"sts:AssumeRole"
]

role_policy_arns = [
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser",
]
}

0 comments on commit a0e58a5

Please sign in to comment.