By NHI Mgmt Group Editorial TeamBased on C1.ai: “Managing Identity as Code: How to Use Terraform with C1” (September 23, 2025)

TL;DR: C1.ai says Terraform can turn manual identity administration into code, letting teams version users, groups, policies, settings, access profiles, and secrets while improving reviewability, consistency, and recovery. Governance becomes safer when identity changes are planned, tracked, and repeatable instead of click-driven and opaque.


At a glance

What this is: This blog explains how Terraform can be used to manage identity as code for users, policies, secrets, applications, entitlements, and access profiles.

Why it matters: It matters because IAM teams need repeatable, reviewable change control for identity settings, especially where manual updates create misconfiguration and recovery risk.

👉 Read C1.ai's blog on managing identity as code with Terraform


Context

Identity administration often fails when changes live only in dashboards and tribal knowledge. In that model, teams cannot reliably preview, version, redeploy, or recover identity configuration, which makes policy drift and change errors hard to contain.

This article argues for treating identity controls as code so that changes can be reviewed in Git, applied consistently, and audited over time. The core governance question is not whether automation is convenient, but whether identity change management can become reproducible and accountable across environments.


Key questions

Q: What breaks when identity policies are updated manually instead of as code?

A: Manual updates increase the chance of misconfiguration, undocumented changes, and inconsistent access across environments. When a mistake happens, teams may not know what changed, who changed it, or how to restore the prior state. That creates both security risk and operational recovery risk, especially when access decisions affect production systems.

Q: Why do code-managed identity policies reduce governance risk?

A: Code-managed policies reduce risk because the approval path, review logic, and revocation handling become visible before deployment. That lowers the chance that a single configuration error silently grants access or routes requests incorrectly, and it gives auditors a clear change record.

Q: How can teams tell whether identity as code is actually working?

A: Look for lower configuration drift, faster review cycles, fewer emergency access fixes, and a complete change history that matches the live environment. If identity changes still require ad hoc console edits or cannot be reproduced from code, the programme is only partially governed. The code should define the intended state, not just document it.

Q: How should teams handle secrets that support identity integrations?

A: Teams should rotate integration secrets through the same controlled deployment process used for other identity changes. That keeps API keys and similar credentials current without relying on manual updates that can cause downtime or leave expired credentials in place.


Technical breakdown

Identity configuration as code

Terraform shifts identity administration from ad hoc clicks to declarative configuration. Administrators define users, groups, policies, and settings in files, then apply them consistently across environments. The important change is not just automation, but repeatability: the desired state is explicit, reviewable, and recoverable. That matters because identity systems are control planes, not just application settings. When the configuration itself is versioned, teams can compare intended changes with actual changes and reduce dependency on individual operator memory.

Practical implication: treat identity configuration as source-controlled infrastructure, not as a set of manual console actions.

Policy as code for approvals and revocations

Policy as code turns approval routing, review assignment, and revocation handling into governed logic rather than hand-edited rules. That is valuable because even a small policy mistake can alter who gets access, who approves it, or how quickly access is removed. In identity programmes, the policy layer is often where governance fails first because it is powerful, hard to inspect, and easy to change informally. Code-based policy management creates a stronger boundary between intended governance and accidental entitlement expansion.

Practical implication: put approval and revocation logic under change control so policy edits are visible before they affect access.

Secrets rotation and integration continuity

The article also shows why secrets belong in the same governance conversation. API keys and other credentials used for integrations must be rotated regularly, but manual updates create expiry risk and downtime. Managing those values through code lets teams inject updated secrets predictably while preserving service continuity. In practice, this is where identity governance meets operations: the credential lifecycle cannot be separate from deployment mechanics if integrations depend on it. The control objective is secure continuity, not just rotation for its own sake.

Practical implication: automate secrets updates alongside configuration deployment so credential changes do not break live integrations.


NHI Mgmt Group analysis

Identity as code is really governance as code. The article is not just about speeding up administration, it is about making identity changes inspectable, versioned, and recoverable. That matters because identity environments fail when the control plane is opaque and changes cannot be traced back to an approved state. Practitioners should read this as a governance model, not a tooling preference.

Policy drift becomes a configuration-management problem when identity rules are editable by hand. A misconfigured approval path or revocation rule can change access outcomes without any corresponding governance record. That is why identity programmes need the same discipline they already apply to application infrastructure: review, approval, and rollback must all be part of the change path.

Secret rotation belongs inside the deployment workflow, not beside it. When integrations depend on API keys or other secrets, manual rotation creates avoidable service risk and weakens operational accountability. The named concept here is identity change recoverability: if a team cannot version, redeploy, and roll back identity changes, then it does not truly control the identity layer.

Access profiles are becoming policy bundles, not just convenience wrappers. The more access is packaged into reusable profiles, the more those profiles function like governed infrastructure objects. That shifts the practitioner question from who can request access to who controls the code that defines the bundle. Teams should treat profile design as a governance decision with downstream entitlement consequences.

The real maturity signal is whether identity operations can survive a bad change. Manual administration can look efficient until the first mistaken click, expired key, or overbroad policy update forces emergency recovery. Programmes that cannot redeploy identity state from code are still running on operator memory, even if they use modern tooling.

What this signals

Identity change recoverability: The useful test for this approach is whether a team can version, review, redeploy, and roll back identity changes with the same confidence it applies to application infrastructure. If not, identity governance still depends on operator memory rather than controlled state.

Terraform-style management also changes how IAM teams should think about entitlement bundles and policy edits. Once access profiles become code, the governance boundary moves upstream to the files and approvals that define them, which makes change discipline the real control surface.


For practitioners

  • Move identity configuration into source control Represent users, groups, policies, settings, and access profiles as declarative files so every change has a reviewed, reproducible history.
  • Require peer review for identity changes Route policy updates, entitlement edits, and access profile changes through approval workflows before they reach production.
  • Automate secret rotation with deployment changes Update API keys and other integration secrets programmatically so credential rotation does not depend on manual console work.
  • Version rollback paths for identity misconfigurations Keep the configuration history needed to redeploy a previous known-good state when a policy or entitlement change causes access issues.
  • Treat entitlement bundles as governed objects Assign owners, descriptions, and approval rules to access profiles and update them through the same controlled process as other identity code.

Key takeaways

  • Manual identity administration creates invisible change paths that are hard to audit, reverse, or reproduce.
  • Managing policies, secrets, and access profiles as code makes identity governance more consistent and less dependent on operator memory.
  • The operational win comes from treating identity state like controlled infrastructure, not from automation alone.

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 addresses the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe article focuses on governing identity entitlements and access profiles through controlled change.
Recommendation — Apply PR.AA-05 to keep entitlement and access profile changes reviewed, traceable, and consistently enforced.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeTerraform-managed policies and access profiles directly affect least-privilege enforcement.
IA-5 — Authenticator ManagementThe article’s secrets rotation discussion maps to credential lifecycle governance.
Recommendation — Use AC-6 to ensure code-defined access bundles do not expand privileges beyond what users need. Use IA-5 to govern the rotation and replacement of integration secrets used by identity systems.
CIS Controls v8CIS-5 — Account ManagementThe post describes repeatable management of users, groups, and access settings.
Recommendation — Apply CIS-5 to centralise account and access changes under a controlled, auditable process.
OWASP Non-Human Identity Top 10NHI-07 — Long-Lived SecretsThe article warns that manually updated integration secrets can expire or linger too long.
Recommendation — Reduce long-lived secret exposure by automating rotation and keeping credential lifecycles under version control.

Key terms

  • Identity as Code: An identity management approach that expresses users, groups, policies, entitlements, and access profiles in versioned configuration files. It brings software-style change control to IAM so teams can review, test, deploy, and recover identity state more consistently across environments.
  • Policy as Code: Policy as code stores authorization logic in version control and evaluates it through testable, reviewable rules. For agent governance, it makes runtime decisions reproducible and measurable, which is critical when actions can be triggered by untrusted content and executed at machine speed.
  • Access Profile: A logical bundle of entitlements grouped for a specific purpose, role, or audience. It lets IAM teams manage access as a unit instead of as isolated permissions, which improves request handling, certification, and revocation. The profile is only useful when its scope matches how the business actually operates.
  • Secrets Rotation: Secrets rotation is the practice of replacing credentials on a schedule or after an event so exposed values stop working quickly. In NHI programmes, rotation must be tied to ownership and automation, otherwise credentials remain valid long after teams believe the risk has been addressed.

What's in the full article

C1.ai's full blog covers the implementation detail this post intentionally leaves at the governance level:

  • How Terraform maps specific identity objects such as users, groups, policies, and access profiles into configuration files
  • Examples of applying version control and peer review to identity changes before they reach production
  • The mechanics of rotating integration secrets programmatically without breaking connected cloud services
  • A case example showing how Brex updated 400 entitlement policies in a few days

👉 The full C1.ai post walks through policy-as-code, secret rotation, and access profile management in more implementation detail.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on June 7, 2026.
Updated on October 7, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org