Skip to content

cluster-bootstrap Operations

tf/cluster-bootstrap is the Terraform module that installs the core cluster infrastructure that ArgoCD depends on. This page states what it holds, how to apply it, and the rules for a state migration.

Property Value
Module tf/cluster-bootstrap/
HCP workspace main-cluster-bootstrap, execution mode local, so a merge does not apply it
Kubernetes auth ~/.kube/configs/fzymgc-house-admin.yml (terraform.tf)
Vault auth the VAULT_TOKEN environment variable

The module declares, in cert-manager.tf, external-secrets.tf, longhorn.tf and argocd.tf:

  • cert-manager, the ICA1 signing key Secret and the fzymgc-house issuer, with the issuer read from Vault PKI in pki.tf.
  • The External Secrets Operator, the Vault CA chain Secret and the vault ClusterSecretStore.
  • Longhorn, its crypto and backup credential Secrets, the longhorn-encrypted and longhorn-1replica-encrypted storage classes, and four recurring jobs.
  • ArgoCD, its OIDC and repository Secrets, and the cluster-app Application that hands every other deployment to GitOps.
Terminal window
cd tf/cluster-bootstrap
terraform init # add -upgrade after a provider bump
terraform plan -out=tfplan
terraform apply tfplan

If the kubernetes provider returns Unauthorized, the admin client certificate has expired. Fetch it again:

Terminal window
ansible-playbook ansible/k3s-playbook.yml --tags k3s-kubeconfig

A provider deprecation that renames a resource type, for example kubernetes_namespace to kubernetes_namespace_v1, is migrated with declarative import and removed blocks, never with terraform state commands:

  1. Rename the resources to the new type and update every reference.
  2. Add import blocks that adopt the live objects into the new addresses.
  3. Add removed { ... lifecycle { destroy = false } } blocks that drop the old addresses from state without deleting the live objects.

The pre-apply plan must show 0 to destroy. A non-zero destroy count means that an address or an import id is wrong. Stop and fix it. After the migration applies, the import and removed blocks are no-ops. Delete them in a later change, after a plan without them shows 0 to destroy. imports.tf and moved.tf hold the blocks that still exist.