fix(iac): pin cloudflare provider + lockfile, trust homelab CA in gitea provider #12
Reference in New Issue
Block a user
Delete Branch "arcodange/iac-provider-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
After the runner-CA fix (#11), the
iacworkflow runs far enough to reachterraform apply(run #27), which surfaced two provider-level failures. This PR fixes both. It complements #11 (merge both); no overlapping lines.1. Cloudflare provider drift
cloudflare/cloudflarewas constrained to~> 5with no committed.terraform.lock.hcl(the old.gitignorerule.terraform.*was hiding it), so every CIinitpulled the latest — now v5.21.1 — wherecloudflare_account_token.policies[].resourcesis a JSON string, not an HCL map:Fixes:
~> 5.21and commit a multi-platform lock file (linux_arm64for the runner +darwin_arm64for local) — stops the drift.jsonencode(...)the module's policyresources(correct shape for ≥5.20; verified against the provider schema).cloudflare_tokenmodule tocloudflare/cloudflarevia its ownrequired_providers— it was defaulting tohashicorp/cloudflare, pulling a redundant second provider..gitignore:.terraform/.terraform.*→.terraform/+*.tfstate*, so the lock file is tracked.2. Gitea provider TLS (x509)
The gitea provider runs inside the
dflook/terraform-applycontainer, which doesn't trust the homelab CA (only theubuntu-latest-carunner does; the vault provider survives because it honorsVAULT_CACERT). Fix: feed the gitea provider the CA via itscacert_fileargument, sourced fromTF_VAR_gitea_cacert_file→ thehomelab.pemthe workflow already writes to the workspace.Validation
Done locally, no prod calls:
tofu initresolves to v5.21.1 + generates the lock file with both platforms.tofu validate→ Success.tofu providers schemaconfirmedpolicies[].resourcesisstringand the gitea provider exposescacert_file.hashicorp/cloudflareremoved.I could not exercise a real
plan/apply(needs Vault JWT + prod credentials + the OAuth handoff).Out of scope (need a live run / operator)
403 "This call has not been granted"); recreate atauth.eu.ovhcloud.com/api/createTokenwithGET/POST/PUT/DELETEon/me/*and/iam/*.arcodange-tfbucket exists (EU jurisdiction, confirmed via API) but v5.21.1 reports it missing on refresh. This is a state/read reconcile (likely a one-timetofu import), not fixable offline — verify on the next live run and don't letauto_approverecreate it.postgres/iacuses exact version pins (low drift risk); a lock file there is a possible follow-up.🤖 Generated with Claude Code