Skip to content

Commit

Permalink
Add example of a Workload Identity Pool configuration for GitHub Acti…
Browse files Browse the repository at this point in the history
  • Loading branch information
b-r-o-c-k authored Oct 9, 2024
1 parent 2c219b6 commit 47f6ff1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mmv1/products/iambeta/WorkloadIdentityPoolProvider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ examples:
vars:
workload_identity_pool_id: 'example-pool'
workload_identity_pool_provider_id: 'example-prvdr'
- name: 'iam_workload_identity_pool_provider_github_actions'
primary_resource_id: 'example'
vars:
workload_identity_pool_id: 'example-pool'
workload_identity_pool_provider_id: 'example-prvdr'
- name: 'iam_workload_identity_pool_provider_oidc_basic'
primary_resource_id: 'example'
vars:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "google_iam_workload_identity_pool" "pool" {
workload_identity_pool_id = "{{index $.Vars "workload_identity_pool_id"}}"
}

resource "google_iam_workload_identity_pool_provider" "{{$.PrimaryResourceId}}" {
workload_identity_pool_id = google_iam_workload_identity_pool.pool.workload_identity_pool_id
workload_identity_pool_provider_id = "{{index $.Vars "workload_identity_pool_provider_id"}}"
display_name = "Name of provider"
description = "GitHub Actions identity pool provider for automated test"
disabled = true
attribute_condition = <<EOT
assertion.repository_owner_id == "123456789" &&
attribute.repository == "gh-org/gh-repo" &&
assertion.ref == "refs/heads/main" &&
assertion.ref_type == "branch"
EOT
attribute_mapping = {
"google.subject" = "assertion.sub"
"attribute.actor" = "assertion.actor"
"attribute.aud" = "assertion.aud"
"attribute.repository" = "assertion.repository"
}
oidc {
issuer_uri = "https://token.actions.githubusercontent.com"
}
}

0 comments on commit 47f6ff1

Please sign in to comment.