Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make security groups and attestations optional #1036

Merged
merged 1 commit into from
Mar 18, 2024
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
7 changes: 5 additions & 2 deletions terraform/gcp/modules/gke_cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ resource "google_container_cluster" "cluster" {
}
}

authenticator_groups_config {
security_group = var.security_group
dynamic "authenticator_groups_config" {
for_each = var.security_group == "" ? [] : [1]
content {
security_group = var.security_group
}
}

depends_on = [google_project_service.service]
Expand Down
1 change: 1 addition & 0 deletions terraform/gcp/modules/gke_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,5 @@ variable "monitoring_components" {
variable "security_group" {
description = "Name of security group used for Google Groups RBAC within GKE Cluster"
type = string
default = ""
}
4 changes: 3 additions & 1 deletion terraform/gcp/modules/rekor/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// Attestation bucket and relevant IAM
resource "google_storage_bucket" "attestation" {
count = var.enable_attestations ? 1 : 0
name = var.attestation_bucket
location = var.attestation_region == "" ? var.region : var.attestation_region
project = var.project_id
Expand All @@ -37,7 +38,8 @@ resource "google_storage_bucket" "attestation" {

// GCS Bucket
resource "google_storage_bucket_iam_member" "rekor_gcs_member" {
bucket = google_storage_bucket.attestation.name
count = var.enable_attestations ? 1 : 0
bucket = google_storage_bucket.attestation[count.index].name
role = "roles/storage.objectAdmin"
member = "serviceAccount:${google_service_account.rekor-sa.email}"
depends_on = [google_storage_bucket.attestation, google_service_account.rekor-sa]
Expand Down
7 changes: 7 additions & 0 deletions terraform/gcp/modules/rekor/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ variable "network" {
}

// Storage
variable "enable_attestations" {
type = bool
default = true
description = "enable/disable storage for attestations"
}

variable "attestation_bucket" {
type = string
default = ""
description = "Name of GCS bucket for attestation."
}

Expand Down
Loading