Skip to content

Commit 6663302

Browse files
chore: Add bucket rw iam binding
1 parent 324ce3c commit 6663302

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

examples/basic/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ module "ctrlplane" {
2424
source = "../../"
2525
namespace = var.namespace
2626
domains = ["example.com"]
27+
fqdn = "example.com"
28+
google_auth = {
29+
client_id = "1234567890"
30+
client_secret = "1234567890"
31+
}
2732
}

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ module "service_accounts" {
7272
source = "./modules/service_accounts"
7373
namespace = var.namespace
7474

75-
depends_on = [module.gke]
75+
bucket_name = module.storage.bucket_name
76+
77+
depends_on = [module.gke, module.storage]
7678
}
7779

7880
resource "google_compute_global_address" "this" {

modules/service_accounts/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ locals {
1919
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-migrations]",
2020
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-event-worker]",
2121
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-event-queue]",
22+
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-workspace-engine]",
2223
]
2324
}
2425

@@ -59,3 +60,9 @@ resource "google_project_iam_member" "gke_sa_token_creator" {
5960
role = "roles/iam.serviceAccountTokenCreator"
6061
member = local.sa_member
6162
}
63+
64+
resource "google_storage_bucket_iam_member" "gke_sa_bucket_rw" {
65+
bucket = var.bucket_name
66+
role = "roles/storage.objectAdmin"
67+
member = local.sa_member
68+
}

modules/service_accounts/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ variable "namespace" {
22
description = "Namespace for the service accounts"
33
type = string
44
}
5+
6+
variable "bucket_name" {
7+
description = "The GCS bucket name to grant access to"
8+
type = string
9+
}

modules/storage/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "bucket_name" {
2+
value = google_storage_bucket.this.name
3+
description = "The name of the bucket."
4+
}

0 commit comments

Comments
 (0)