Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ module "ctrlplane" {
source = "../../"
namespace = var.namespace
domains = ["example.com"]
fqdn = "example.com"
google_auth = {
client_id = "1234567890"
client_secret = "1234567890"
}
}
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ module "service_accounts" {
source = "./modules/service_accounts"
namespace = var.namespace

depends_on = [module.gke]
bucket_name = module.storage.bucket_name

depends_on = [module.gke, module.storage]
}

resource "google_compute_global_address" "this" {
Expand Down
7 changes: 7 additions & 0 deletions modules/service_accounts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ locals {
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-migrations]",
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-event-worker]",
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-event-queue]",
"serviceAccount:${local.project_id}.svc.id.goog[${local.gke_namespace}/ctrlplane-workspace-engine]",
]
}

Expand Down Expand Up @@ -59,3 +60,9 @@ resource "google_project_iam_member" "gke_sa_token_creator" {
role = "roles/iam.serviceAccountTokenCreator"
member = local.sa_member
}

resource "google_storage_bucket_iam_member" "gke_sa_bucket_rw" {
bucket = var.bucket_name
role = "roles/storage.objectAdmin"
member = local.sa_member
}
5 changes: 5 additions & 0 deletions modules/service_accounts/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ variable "namespace" {
description = "Namespace for the service accounts"
type = string
}

variable "bucket_name" {
description = "The GCS bucket name to grant access to"
type = string
}
4 changes: 4 additions & 0 deletions modules/storage/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "bucket_name" {
value = google_storage_bucket.this.name
description = "The name of the bucket."
}
Loading