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

fix: policy bundles now use idx as resource name (bundles will be re-applied) #1657

Merged
merged 2 commits into from
Jun 2, 2023
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
4 changes: 2 additions & 2 deletions modules/acm/creds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ resource "tls_private_key" "k8sop_creds" {
rsa_bits = 4096
}

# Wait for the ACM operator to create the namespace
# Wait for ACM
resource "time_sleep" "wait_acm" {
count = (var.create_ssh_key == true || var.ssh_auth_key != null || var.enable_policy_controller || var.enable_config_sync) ? 1 : 0
depends_on = [google_gke_hub_feature_membership.main]

create_duration = "300s"
create_duration = (length(var.policy_bundles) > 0) ? "600s" : "300s"
}

resource "google_service_account_iam_binding" "ksa_iam" {
Expand Down
7 changes: 4 additions & 3 deletions modules/acm/policy_bundles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ module "policy_bundles" {
source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper"
version = "~> 3.1"

for_each = toset(var.policy_bundles)
# Use index as name to avoid long url or special filesystem chars
for_each = { for i, v in var.policy_bundles : i => v }
apeabody marked this conversation as resolved.
Show resolved Hide resolved
project_id = var.project_id
cluster_name = var.cluster_name
cluster_location = var.location
kubectl_create_command = "kubectl apply -k ${each.key}"
kubectl_destroy_command = "kubectl delete -k ${each.key}"
kubectl_create_command = "kubectl apply -k ${each.value}"
kubectl_destroy_command = "kubectl delete -k ${each.value}"

module_depends_on = [time_sleep.wait_acm]
}