Commit 30f361e authored Jun 9, 2024 · 1 / 2 · Verified
1 parent c66162c commit 30f361e Copy full SHA for 30f361e
File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,12 @@ No modules.
59
59
| ------| ------|
60
60
| [ google-beta_google_iam_workload_identity_pool.chainguard_pool] ( https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_iam_workload_identity_pool ) | resource |
61
61
| [ google-beta_google_iam_workload_identity_pool_provider.chainguard_provider] ( https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_iam_workload_identity_pool_provider ) | resource |
62
+ | [ google_project_iam_member.catalog-syncer-push] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member ) | resource |
62
63
| [ google_project_service.iamcredentials-api] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_service ) | resource |
64
+ | [ google_service_account.catalog-syncer] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account ) | resource |
63
65
| [ google_service_account.chainguard_canary] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account ) | resource |
64
66
| [ google_service_account_iam_binding.allow_canary_impersonation] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account_iam_binding ) | resource |
67
+ | [ google_service_account_iam_binding.catalog-syncer-impersonation] ( https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account_iam_binding ) | resource |
65
68
66
69
## Inputs
67
70
Original file line number Diff line number Diff line change
1
+ // The service account to impersonate
2
+ resource "google_service_account" "catalog-syncer" {
3
+ project = var. project_id
4
+ account_id = " chainguard-catalog-syncer"
5
+ depends_on = [google_project_service . iamcredentials-api ]
6
+ }
7
+
8
+ // Allow the provider (mapped token) to impersonate this service account if
9
+ // the subject matches what we expect.
10
+ resource "google_service_account_iam_binding" "catalog-syncer-impersonation" {
11
+ service_account_id = google_service_account. catalog-syncer . name
12
+ role = " roles/iam.workloadIdentityUser"
13
+ members = [for id in var . group_ids : " principalSet://iam.googleapis.com/${ google_iam_workload_identity_pool . chainguard_pool . name } /attribute.sub/catalog-syncer:${ id } " ]
14
+ }
15
+
16
+ // Grant the service account permissions to access the resources it
17
+ // needs to fulfill its purpose.
18
+ resource "google_project_iam_member" "catalog-syncer-push" {
19
+ project = var. project_id
20
+ role = " roles/artifactregistry.writer"
21
+ member = " serviceAccount:${ google_service_account . catalog-syncer . email } "
22
+ }
You can’t perform that action at this time.
0 commit comments