Separate Provider Capabilities from Deployment Tool Preferences
Terraform core has no Kubernetes vocabulary. A resource type such as a Deployment exists only because a provider implements it. The cluster endpoint, the credential and the API calls all live behind that plugin, and Terraform itself never learns what a Deployment means.
Two providers, two units of change. hashicorp/kubernetes manages individual API objects, while hashicorp/helm manages a release. They can share a kubeconfig and an endpoint, but they do not share a diff, a lifecycle or a rollback procedure.
A chart is packaging, not a running system. A chart holds templates, default values, dependency declarations and an optional crds/ directory. Rendering is a local transformation from values into YAML; the chart by itself changes nothing in the cluster.
A release is a record of an operation. Helm renders the chart, sends the objects to the API, and writes a release record containing the rendered manifest and revision metadata. By default that record is a Secret whose type is helm.sh/release.v1.
A release record is not a controller. Once the operation finishes, no process keeps watching the live Deployment. Drift survives until another release, a GitOps sync or a manual edit changes the object.
Three layers fail independently. Packaging fails at render time, release state fails at the history, and cluster reconciliation fails at readiness. Keep those layer names in the incident, because "Helm failed" does not say which one broke.
The Kubernetes provider cannot install a chart. It has no chart or release resource. kubernetes_manifest can apply arbitrary YAML, but then Terraform owns each rendered object and there is no Helm release at all.
The Helm provider is not a second Kubernetes provider. It gives you one release resource whose inputs are a chart, a set of values and a chart version. You do not get Deployment resources from it, and you should not expect its diff to behave like theirs.
A plan on a Helm release is not a per-object diff. The provider compares declared release inputs with the last release; it does not read every live field of every rendered object. A manual scale or image edit can therefore survive a clean plan.
Version pins are part of the boundary. This part is written against Terraform 1.17.1 and hashicorp/helm 3.3.0, the version the registry reports as current here, with hashicorp/kubernetes 3.5.0. Treat any provider upgrade as a change to the ownership contract, not as a patch.
Figure 1 follows a chart from package to release record to running pods, and marks the two claims each tool cannot make.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
PKG["Chart package
templates, defaults, crds/"] --> MERGE["Values merge
environment overrides"]
MERGE --> RENDER["Render templates
to Kubernetes objects"]
RENDER --> API["Kubernetes API
object stored in etcd"]
API --> CTRL["Built-in controllers
Deployment, StatefulSet"]
CTRL --> LIVE["Live pods and endpoints
observed status"]
RENDER --> REL["Release record
one revision"]
REL --> SEC[("Secret
helm.sh/release.v1")]
SEC --> HIST["History
revision N and N-1"]
K8S["hashicorp/kubernetes
typed resources"] -->|"writes one object"| API
HELM["hashicorp/helm
helm_release"] -->|"renders, applies, records"| RENDER
HELM --> REL
K8S -.->|"no chart resource"| X1["Cannot install a chart"]
HELM -.->|"no continuous loop"| X2["Drift waits for the next apply"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class PKG,MERGE,HELM primary;
class RENDER,API,CTRL,K8S secondary;
class LIVE,SEC,HIST ok;
class X1,X2 danger;
Figure 2 draws the same separation as a stack: packaging at the top, release state in the middle, and cluster reconciliation at the bottom.
Table 1 puts the same distinction into a decision aid: which layer a tool owns, where its evidence lives, and whether it keeps working after the command exits.
| Layer | What it owns | Where the evidence lives | Keeps reconciling? |
|---|---|---|---|
| Chart package | templates, defaults, values schema | a Git repository or chart repository | no |
| Helm release | one install, upgrade or rollback operation | a release Secret plus an entry in Terraform state | no |
| Kubernetes object | the desired spec of one API resource | etcd, read by the API server | yes, through built-in controllers |
| GitOps application | the set of objects named by a Git path | Git plus the controller's status | yes, through the GitOps controller |
| Terraform root | resource addresses and their last applied values | the state file and its lock | no, only during plan and apply |
The table answers "which tool" but not "which owner." A release and an application can both be legitimate artifacts while naming the same Deployment. Ownership is the next decision, and it belongs to the object rather than to the provider.
Choose Who Owns Each Chart and Rendered Object
Ownership is per object and per field, not per tool. A tool may be responsible for a class of objects, but each object still needs exactly one writer. The same rule that keeps a replica count out of two controllers keeps a Deployment out of two deployment mechanisms.
Three clean models cover most estates. Terraform Helm owns a chart and everything it renders, Terraform manifest owns individual objects, or GitOps owns the application objects named by Git. Choose by object class, not by which tool the team enjoys more.
The chart boundary is the natural unit. If a chart renders a Deployment, a Service, a ConfigMap and a PodDisruptionBudget, all four belong to the release. Pulling one of them into a separate Terraform resource creates the fight this section is about.
Platform objects are the exception that proves the rule. Namespace, CRDs, RBAC and network policy often belong to a platform root. The application chart should not also render them, because then a platform apply and an application release both write the same cluster-scoped object.
Adoption is a migration, not a setting. Helm's ownership annotations and the provider's take_ownership option let a release adopt an existing object. Argo CD can adopt by tracking label. Both move the writer; neither makes two writers safe.
Labels are evidence, not enforcement. Helm marks objects with a managed-by label and release annotations, Argo CD marks its own with an instance label, and server-side apply records field managers. Terraform sets no ownership label or annotation of its own, so its state is the primary record; a kubernetes_manifest field manager appears in managedFields, but that is a field-level trace rather than a lifecycle marker.
The namespace is the most common double ownership. A release with create_namespace and a Terraform namespace resource both claim the same object. Helm creates it but does not delete it; Terraform deletes it and takes every object inside with it.
Deletion exposes the second writer faster than apply does. Terraform destroy uninstalls the release, Argo self-heal recreates the objects, and the destroy looks stuck. The reverse happens when Argo prunes an object that a Helm release still expects to find.
Name the owner in the repository. One directory per owner, one pipeline per directory, and a review rule that rejects a chart edit and a Terraform edit for the same object in one change. A comment in a pull request is weaker than a path that only one pipeline can deploy.
You can detect dual ownership before an incident. List objects with their labels and managed fields, then compare those names with the addresses in Terraform state. Two field managers on the same field is the signal that a second writer is already active.
Figure 3 turns the decision into a flow and keeps the failure branches visible: a second writer, a shared namespace and a shared CRD.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
W["One object to manage"] --> Q{"Who will write it?"}
Q -->|"chart with hooks and revisions"| H["Terraform helm_release"]
Q -->|"plain object, no chart"| K["Terraform kubernetes_manifest"]
Q -->|"Git is the source of truth"| G["Argo CD Application
or Flux Kustomization"]
H --> R["Rendered object
Deployment, Service, ConfigMap"]
K --> R
G --> R
R --> D{"Second writer configured?"}
D -->|"no"| OK["Clean plan, one rollback path"]
D -->|"yes"| BAD["Adoption or prune fight"]
BAD --> B1["Helm take_ownership
adopts the object"]
BAD --> B2["Argo prune deletes it
Helm restores it on the next release"]
BAD --> B3["Terraform plan reports drift
on every run"]
NS["Namespace"] --> NSQ{"Who creates it?"}
NSQ -->|"both paths configured"| NSBAD["Delete order race"]
NSQ -->|"one explicit owner"| NSOK["Namespace outlives the release"]
C["CRD"] --> CQ{"crds/ or manifest?"}
CQ -->|"both"| CBAD["Schema and delete fight"]
CQ -->|"one owner"| COK["Schema changes have one path"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class W,Q,H,K,G primary;
class R,NS,C secondary;
class OK,NSOK,COK ok;
class BAD,B1,B2,B3,NSBAD,CBAD danger;
class D,NSQ,CQ warn;
A single chart can still cross the boundary. The usual mistake is a chart that renders the namespace "for convenience" while the platform root also creates it. Remove the namespace from the chart, pass its name as a value, and let the platform root keep the lifecycle.
A single Terraform root can also cross it. One root that installs the chart, creates the namespace, applies the CRD and manages the GitOps Application has four owners in one plan. Split the addresses by lifecycle, not by resource type.
Bootstrap GitOps Without Becoming a Second Application Reconciler
Bootstrap is an installation; GitOps is a loop. Terraform can create the controller, its CRDs and its root object, then stop. The loop belongs to the controller, and it keeps running on its own schedule after the pipeline has exited.
Terraform's legitimate GitOps objects are few. Namespace, Argo CD or Flux installation, CRDs, a project boundary, a repository credential reference, and the root Application or Kustomization. Everything below that line belongs to Git.
The root object is the handoff artifact. An app-of-apps Application or a Flux Kustomization names the path that contains the child objects. Terraform creates the root; Git owns the children, including their sync policy and their deletion behavior.
Git becomes the desired state at the handoff line. A later Terraform edit to an application object is a competing writer even when it is a hotfix. The controller will revert it on the next sync, usually without anyone watching the Terraform plan.
Sync policy decides how loud the controller is. Automated sync with prune and self-heal makes drift visible and corrected; manual sync still owns the object on the next run. Ownership is not "who touched it last," it is "who will write it next."
Self-heal is a plan with a consequence. Terraform reports drift and waits for a human; Argo CD or Flux reverts it. Enabling both for one object produces a loop where each correction becomes the other's drift.
Credentials belong to the controller. Repository credentials and cluster secrets are controller inputs, not application manifests. If Terraform creates the secret, Terraform owns its lifecycle; an external secret manager is usually a cleaner owner.
Bootstrap ordering is a CRD problem before it is a Git problem. The Application CRD must exist before any Application object, so the controller install has to complete first. Inside one root a dependency edge is enough; across roots, publish a readiness signal and gate the second apply.
Deletion has a direction. Deleting the root Application with cascading finalizers removes the children; Terraform destroy of the bootstrap root should not be the routine way to delete applications. Decide which direction is allowed before the first incident.
Disaster recovery needs two artifacts. The bootstrap root recreates the controller and the root object, and the Git repository recreates the applications. Losing Terraform state costs a re-import; losing Git costs the source of truth.
Figure 4 draws the handoff as a boundary with a controller loop on one side and a bootstrap root on the other.
A bootstrap root that keeps the application is not a bootstrap root. It is a second reconciler with a slower schedule. The test is simple: change a workload field in Terraform, apply it, and watch whether the controller reverts it.
A manual sync is still an owner. Turning off automated sync reduces the number of corrections, but the next sync still writes the object. The boundary is about who has the authority to write, not about how often the write happens.
Coordinate Controller CRDs and Chart Upgrades
A CRD is cluster-scoped schema, and it outlives any release. Custom resources are instances of that schema, while the controller that acts on them is a separate Deployment. The CRD, the controller and the custom resources have three different lifecycles.
Helm's crds/ directory is install-only. Helm applies those files before templates on install, skips them when they already exist, and does not upgrade or delete them on upgrade, rollback or uninstall. A schema change in a new chart version therefore does not reach the cluster.
skip_crds makes the boundary explicit. Set it on the release and own the CRDs in a platform root. The alternative, letting Helm install them once and assuming they stay current, is exactly the failure this section is about.
A CRD and its custom resource cannot share a first plan. kubernetes_manifest fetches the schema for the resource during planning, so a CR whose CRD is created in the same root fails before apply. Split CRDs into a platform root and CRs into the application root.
Two-stage apply is a root boundary, not a targeting habit. The -target option is recovery, not deployment. A separate root with its own state and a published readiness gate gives the same order without weakening the plan.
Schema changes go additive first. Add an optional field in a new served version, migrate writers and readers, switch storage, then remove the old version. Renaming or removing a field in one step breaks stored objects and old clients.
Conversion webhooks add a serving dependency. If the CRD converts between versions through a webhook, the controller must be healthy before the new version is served. A webhook outage turns reads into failures, not just writes.
Controller and CRD versions are a pair. The safe order is the one where both the old and the new controller understand every served version. Write that matrix down; it is the only thing that tells you which side can move first.
Deleting a CRD deletes every custom resource. Kubernetes garbage-collects the instances with the schema. Helm's refusal to delete crds/ is protection; a Terraform destroy of a platform root is not.
Namespace deletion deletes the release record. Helm stores revisions in the release namespace, so deleting the namespace removes the history Terraform still references. The next refresh has no release to read, and the workload root cannot explain the gap.
atomic and cleanup_on_fail do not roll back schema. They act on the release's rendered objects, not on CRDs or namespaces. A rollback that restores the old template against a new schema is not a rollback.
force_update is a delete and recreate, not a schema fix. It can recover an immutable-field error by replacing objects, at the cost of availability. It does not make an incompatible CRD compatible.
Figure 5 contrasts the additive upgrade order with the failure path that a chart-managed CRD and a Terraform-managed namespace create.
Test the schema before the release. A server-side dry run of the new CRD catches structural errors without creating anything. It does not prove that stored objects can be converted, so pair it with a copy of a real custom resource.
Ordering tools express sequence, not compatibility. Terraform edges, Argo sync waves and Flux dependencies all say "after." Only the version matrix says "safe," which is why the matrix belongs in the pull request.
Prove a Clean Handoff and a Reversible Upgrade
The proof has three events and one owner at a time. A release, an out-of-band change and a rollback each produce evidence; the evidence only means something if exactly one writer is active. Run the same chart under Terraform Helm in one namespace and under GitOps in another, so the comparison never becomes a competition.
A clean plan is not a release proof. The plan can be empty because nothing changed, because the controller already corrected the drift, or because Terraform never reads the fields that moved. Record which of those three happened before calling the boundary proven.
Prove a Clean Handoff and a Reversible Upgrade
Execution status: design-only. The procedure is written for Terraform 1.17.1, hashicorp/helm 3.3.0 and hashicorp/kubernetes 3.5.0 against a disposable cluster. No command output or identifier is recorded here, and nothing in this card was run against a live environment.
Prerequisites. A reachable cluster, a Git repository you can commit to, Argo CD or Flux already installed by a platform owner, and two empty namespaces. The chart must render a Deployment, a Service and a ConfigMap, and it must not create its own namespace or CRDs.
| Namespace | Owner of the workload | Terraform owns | GitOps controller owns |
|---|---|---|---|
| lab-tf | Terraform Helm release | namespace, release, every rendered object | nothing |
| lab-gitops | Argo CD or Flux | namespace and the root Application only | the Deployment, Service and ConfigMap |
- Apply the bootstrap root for both namespaces. In lab-tf it creates a
helm_release; in lab-gitops it creates the namespace and one root Application whose path is the chart directory in Git. Confirm the Terraform plan is clean after the first apply. - Prove the Terraform release. Read the release name and revision from
helm list, then read the same revision from Terraform state. Confirm the chart version in state matches the version in the cluster. - Prove the GitOps release. Read the Application or Kustomization status and confirm it reports Synced and Healthy. Confirm that terraform state contains the root object but no Deployment address for lab-gitops.
- Change a live object out of band in both namespaces, for example by scaling the Deployment by hand. In lab-tf, run a plan and record whether Terraform notices; in lab-gitops, wait for the controller and record whether self-heal restores the declared count.
- Correct the Terraform-owned drift with a chart input change and a second apply, then read the new revision. Do not run a separate Helm rollback in the GitOps namespace, because the next sync would undo it.
- Roll back the Terraform namespace by reverting the chart version or value and applying. Roll back the GitOps namespace by reverting the Git commit and letting the controller sync. In both cases, confirm the previous revision is addressable before starting.
- Delete one rendered object out of band in each namespace. Under Terraform Helm the next release that touches it should restore it; under GitOps the next sync should restore it. A recreate loop in either namespace means the other owner is still active.
- Check for leftovers: the namespace still exists, the CRD still exists, the release history is intact, and no object remains with a tracking label from the wrong owner.
| Evidence | Terraform Helm namespace | GitOps namespace | What it proves |
|---|---|---|---|
| release record | Helm revision and Terraform state agree | controller status plus Git commit | one release path is authoritative |
| out-of-band change | plan may stay clean until the next release | self-heal reverts on the next sync | which mechanism actually reconciles |
| rollback | old chart version applied again | Git revert synced by the controller | one reversible procedure, not two |
| leftovers | no orphaned objects after destroy | root Application and children removed together | deletion follows ownership |
Expected observation. The Terraform namespace shows a release record and a plan that is quiet about live fields it does not read; the GitOps namespace shows a controller that corrects the same kind of drift without Terraform proposing a change. Reverting the declared input restores each namespace, and neither namespace ever has two active writers.
Failure checks. The lab fails if Terraform state contains a Deployment from lab-gitops, if the GitOps controller reports drift in lab-tf, if a rollback in one namespace creates an object in the other, or if deleting the root Application leaves application objects without an owner.
Cleanup. Delete both namespaces through their owning root, then confirm the release Secrets and the Application finalizers are gone. Keep the platform CRDs and the Git repository, because they are the reusable part of the proof.
Evidence to keep. The two clean plans, the release revision, the controller sync status, the out-of-band change and its correction, and the rollback result for each namespace.
Next in the Series
In Policy and Isolation: Quotas, Admission and Network Enforcement, we'll explore Prove that declared security controls are supported and enforced by the cluster data plane.