The server may interpret the empty object as no change, which leaves old configuration in place. That creates stale settings, unexpected behavior, and hard to diagnose drift between what the manifest says and what the platform actually enforces. Teams should verify that field removal results in explicit deletion, not silent retention.
Why This Matters for Security Teams
An empty configuration object can look harmless in Terraform, but many platforms do not treat “empty” as “remove.” If the API interprets the payload as no-op, the prior setting survives and the intended control never changes. For NHI and secrets-managed systems, that means stale access, stale endpoints, or stale rotation policy can remain active long after the manifest says otherwise. NHI Mgmt Group notes that only 20% of organisations have formal offboarding and revocation processes for API keys, which makes silent retention especially risky. See the Ultimate Guide to NHIs and the NIST Cybersecurity Framework 2.0 for the governance context.
The practical issue is drift between declarative intent and platform state. Security teams often assume Terraform’s plan reflects the effective outcome, but provider behavior, API merge semantics, and default inheritance can preserve old values unless the field is explicitly nulled or deleted. In identity-adjacent systems, that can leave keys, roles, or network exceptions active in the background. In practice, many security teams encounter this only after a rotation, policy update, or incident review has already failed to remove the old setting.
How It Works in Practice
Terraform sends resource changes through provider logic, and each provider maps those changes to the target API differently. An empty object may serialize as “present but blank,” which some APIs interpret as an update with no meaningful field changes. Others merge the request into existing state instead of replacing it. The result is that the prior configuration survives unless the provider issues an explicit delete, unset, or patch-remove operation.
For teams managing NHIs, secrets, or access policy, the key question is not whether Terraform applied successfully, but whether the downstream service actually removed the old value. That is why configuration deletion needs verification at the API and runtime layers, not just in the Terraform state file. The Twitter Source Code Breach is a reminder that hidden identity and secrets exposure often persists through weak lifecycle controls rather than obvious one-time mistakes.
- Check whether the provider uses PATCH, PUT, or delete semantics for that field.
- Confirm whether an empty object, null, or explicit remove marker is required.
- Validate the live object after apply, not only the Terraform plan output.
- Prefer tests that compare desired state to effective platform state.
- Use policy-as-code and drift detection to catch silent retention early.
When possible, pair Terraform with runtime checks against the API response or a post-deploy audit. For sensitive settings, the safest pattern is explicit deletion plus verification, not assumption-based cleanup. This guidance tends to break down when providers obscure API semantics, because the IaC layer can report success even while the platform keeps the previous value.
Common Variations and Edge Cases
Tighter deletion controls often increase operational overhead, requiring organisations to balance deterministic cleanup against provider-specific complexity. The main tradeoff is between portability and precision: a reusable module may be easier to maintain, but a single empty object pattern may not behave consistently across services. Current guidance suggests treating “unset,” “empty,” and “removed” as distinct states unless the provider documentation clearly proves otherwise.
Edge cases are common in systems that inherit defaults, merge nested objects, or store partial overrides. Some APIs preserve unspecified subfields, while others require a full object replacement to clear prior values. This is especially risky for secret rotation schedules, access policy exceptions, and integration endpoints, where an old value can remain valid even after a configuration refactor. The Ultimate Guide to NHIs is relevant here because stale NHI settings often outlive the change that was meant to remove them.
Best practice is evolving, but the operational rule is simple: confirm provider semantics in a non-production environment, then verify the resulting live state. If the platform does not clearly support field deletion, use an explicit destroy-and-recreate or a dedicated removal mechanism instead of relying on an empty object. There is no universal standard for this yet, which is why teams should document deletion behavior per provider and test it whenever modules change.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and CSA MAESTRO address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-03 | Stale config can leave NHI credentials and settings active. |
| NIST CSF 2.0 | PR.AC-4 | Access changes must be enforced, not just declared in code. |
| NIST AI RMF | GOVERN | Governance needs assurance that automation reflects actual platform state. |
| NIST Zero Trust (SP 800-207) | AC-1 | Zero trust relies on continuous, accurate enforcement state. |
| CSA MAESTRO | GOV-03 | Agentic and automated workflows need explicit change validation. |
Treat stale configuration as an enforcement gap and revalidate trust decisions after changes.
Related resources from NHI Mgmt Group
- What breaks when child accounts are populated manually instead of using controlled vault migration processes?
- What breaks when identity events are treated as brand exposure instead of governance opportunities?
- What breaks when endpoint deployment settings stay hidden inside complex one-off configuration blocks?
- What breaks when GRC tools only send notifications instead of executing remediation?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 27, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org