Skip to content

Commit b5a32be

Browse files
sulibotclaude
andcommitted
feat: integrate post-bootstrap script into Terraform automation
Added null_resource.post_bootstrap that automatically runs the post-bootstrap script after Flux installation: - Fixes stuck HelmReleases (observedGeneration: -1 bug) - Patches CoreDNS configuration - Reclaims Kopia backup repository The script runs automatically at the end of Terraform bootstrap, ensuring the cluster is fully operational without manual intervention. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 0296e2f commit b5a32be

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

scripts/post-bootstrap.sh

100644100755
File mode changed.

terraform/infra/modules/talos_bootstrap/main.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,31 @@ resource "null_resource" "sops_age_secret" {
151151
flux_bootstrap_git.this
152152
]
153153
}
154+
155+
# Run post-bootstrap operations (HelmRelease fix, Kopia restore)
156+
resource "null_resource" "post_bootstrap" {
157+
count = var.flux_git_repository != "" && var.repo_root != "" ? 1 : 0
158+
159+
triggers = {
160+
sops_secret_created = try(null_resource.sops_age_secret[0].id, "")
161+
}
162+
163+
provisioner "local-exec" {
164+
working_dir = var.repo_root
165+
command = <<-EOT
166+
# Create temp kubeconfig for post-bootstrap script
167+
KUBECONFIG_FILE=$(mktemp)
168+
echo '${base64encode(talos_cluster_kubeconfig.cluster.kubeconfig_raw)}' | base64 -d > "$KUBECONFIG_FILE"
169+
170+
# Run post-bootstrap script
171+
KUBECONFIG="$KUBECONFIG_FILE" ./scripts/post-bootstrap.sh
172+
173+
# Cleanup
174+
rm -f "$KUBECONFIG_FILE"
175+
EOT
176+
}
177+
178+
depends_on = [
179+
null_resource.sops_age_secret
180+
]
181+
}

0 commit comments

Comments
 (0)