OkaySuite
← Back to Resources
Backup & Restore· November 4, 2026

Back up and restore an Okta tenant with Terraform

You already manage Okta with Terraform. Can you use it as a backup and restore tool? The short answer is no.

What Terraform really can and cannot do with Okta.

Technical article. Sources: Okta Developer documentation, HashiCorp Terraform, the okta registry (v7.1.0), the Okta DevForum, and a fair amount of hands-on Terraform and Okta experience.

The starting point

A lot of teams ask the same question: "We already manage Okta with Terraform. Can we use it as a backup and restore tool?" The short, documented answer below is no. Even so, Terraform can do quite a lot, and that can usefully contribute to a partial backup and restore of your Okta tenant. Let's look at it more closely.

Terraform describes a desired configuration, compares it with what already exists, then pushes changes through the API. It is not a tool designed to back up an Okta tenant. HashiCorp puts it this way: state links your resources to remote objects. It is not a backup. Okta presents Terraform as a lever for audit, control, and deployment. And in the field, the experience is unambiguous: Terraform is excellent, but it is not a backup and restore tool.

The Okta DevForum points the same way: a full transfer of a tenant's configuration is not available to customers.

What you can actually do with Terraform: version the configuration the provider knows how to manage, import it if it already existed outside Terraform, and reapply it to the same org or to another Okta org. This is not a point-in-time snapshot of the tenant (users, MFA enrollments, secrets, system apps, directory sync, history, and so on are not included).

What Terraform actually "saves"

The .tf files in Git are the real memory of the configuration, but only for what has been coded or imported. The terraform.tfstate file is only an operational mapping (config ↔ Okta IDs). Okta recommends storing it remotely (S3, HCP Terraform, and so on) so you can version it, encrypt it, and share it. Useful, even essential on a team… but it does not replace a real Okta backup.

There are also two Okta recommendations that will save you a lot of grief: one Terraform configuration per org, and a single management mode per object type (either Terraform or the Admin Console). Mixing the two is a near guarantee of drift.

How to capture the configuration (the realistic "backup")

Starting from scratch

The ideal scenario: you declare groups, apps, policies, and authorization servers in HCL, you version them, you apply, and you put state in a remote backend. In that world, the "backup" of the managed configuration is Git plus the remote backend.

When the Okta org already exists

Then you go through import. Since Terraform 1.5, import blocks replace the old hand-run terraform import. Okta documents two approaches.

The first, minimal one: you create the resource, you add the import with the Okta ID (taken from the Admin Console URL or from the LIST API), you run terraform plan, and you align every field that drifts from the provider defaults. You repeat until the diff is zero, then apply. Okta is emphatic about this: skip the alignment and you risk surprise changes on the org.

The second is more comfortable for an audit: terraform plan -generate-config-out=…. Terraform generates the HCL, you trim useless defaults, you replace raw IDs with references (okta_policy.xxx.id), you copy the result into the main configuration, you re-plan until it is stable, then apply.

Two Okta guardrails to keep in mind: it is better not to import users (too large: memberships plus app assignments), and Okta feature settings cannot be imported. For singleton objects (some settings), the dummy singleton ID, "." or "_", does the job.

How to "restore"

Same tenant

The goal is to have Terraform adopt existing objects without recreating them. Keep the import blocks with the current tenant's IDs. The plan must say "will be imported," not "will be created." Without an import, an empty state will try duplicate CREATEs. That is a classic, and it hurts.

Another tenant (staging to production, or a fallback org)

Point the provider at the target, remove the import blocks (the source IDs do not exist there), and make sure cross-references are Terraform expressions, not literal IDs. Okta IDs do not travel from one org to another. Secrets (client secrets, keys, integration passwords) are supplied separately: they generally do not come out in the HCL. Then plan, review, and apply. You rebuild what the provider knows how to create, not the entire tenant.

The limits you have to accept

The provider does not cover the whole Okta model. System apps, some built-ins, feature settings that cannot be imported, schemas or policy conditions that are sometimes poorly mapped: there are gaps in quite a few places.

Dynamic data — users, directory-backed objects, highly volatile integrations — does not fit well in a durable Terraform model. Okta confirms this by advising against importing users.

No point-in-time snapshot, no tenant rollback, no magical dependency clone:

Drift between the Admin Console UI and Terraform is real. So are rate limits: a large plan or apply can fail with HTTP 429. Okta documents this: max_api_capacity, backoff, saved plans, refresh=false (with precautions).

And even after a successful apply on a new org, passwords, MFA factors already enrolled, sessions, logs, live AD/LDAP sync, and configuration outside the provider… none of that "comes back" through Terraform.

Pros and cons, on one page

TopicThe upsideThe downside
PositioningVery good for Okta IaC: review, CI/CD, reproducible configurationIt is not a tenant backup or disaster-recovery tool
BackupVersioned .tf files save the declared configurationNo full capture and no PITR
Restore, same orgImport plus apply: a clean adoptionImport takes a long time; risk if fields are not aligned
Restore, another orgRecreation is possible if the code is cleanIDs are not portable; secrets must be reinjected; provider gaps
Users and directoriesGroups and assignments are a better fitUsers are not recommended; directories are too dynamic
StateRemote backend: versioning, locking, collaborationState is not a backup; it can contain secrets
OperationsA readable plan and a controlled applyRate limits, expensive refreshes, large graphs that are slow
GovernanceOne management mode per object typeUI plus Terraform means drift and perpetual diffs
Real disaster recoverySpeeds up configuration rebuildsNo PITR, no native standby tenant

Object-by-object matrix: Okta object → Terraform resource → can it be backed up?

"Can be backed up" here means: configuration that can be represented and reapplied through Terraform, not a full backup of the Okta tenant.

Conventions and definitions:

ValueMeaning
Yes (config)Can be represented in HCL and reapplied (same org via import, another org via recreate)
PartialThe resource exists, but the restore is incomplete (secrets, runtime, gaps, manual steps)
Not recommendedTechnically possible, a poor choice for a backup or disaster-recovery strategy
NoNo useful resource, not importable, or a system object outside the provider

Applications and assignments

Okta objectTerraform resourceCan be backed up
OIDC / OAuth appokta_app_oauth (+ redirect URI, API scope, role assignment…)Partial (secrets must be reinjected)
SAML appokta_app_saml (+ app_settings)Partial (certs / metadata)
Bookmark / SWA / Auto Login / Basic Auth / SPS / Three Field / Shared Credsokta_app_bookmark, okta_app_swa, okta_app_auto_login, okta_app_basic_auth, okta_app_secure_password_store, okta_app_three_field, okta_app_shared_credentialsYes (config) / Partial if credentials are involved
App access policy assignmentokta_app_access_policy_assignmentYes (config)
App sign-on policy / rulesokta_app_signon_policy, okta_app_signon_policy_rule(s)Yes (config)
Group → app assignmentokta_app_group_assignment(s)Yes (config)
User → app assignmentokta_app_userNot recommended
App profile schemaokta_app_user_schema_property, okta_app_user_base_schema_propertyYes (config)
System apps (Admin Console…)—No
App features / tokensokta_app_features, okta_app_tokenPartial

Users, groups, schemas

Okta objectTerraform resourceCan be backed up
Userokta_userNot recommended (Okta); passwords and MFA are not restored
User admin rolesokta_user_admin_rolesPartial
Membershipsokta_user_group_memberships, okta_group_membershipsPartial / not recommended at scale
User factor (question)okta_user_factor_questionNo
Groupokta_groupYes (config)
Group rule / owners / rolesokta_group_rule, okta_group_owner(s), okta_group_roleYes (config)
Group / user schemasokta_group_schema_property, okta_user_schema_property, okta_user_base_schema_propertyYes (config)
User type / profile mappingokta_user_type, okta_profile_mappingYes (config)
Built-in group (Everyone…)data source, not a classic exportNo (reference it, do not "back it up")

Policies and authentication

Okta objectTerraform resourceCan be backed up
Sign-on / global sessionokta_policy_signon + okta_policy_rule_signonYes (config)
MFA policyokta_policy_mfa / _default + okta_policy_rule_mfaYes (config)
Password policyokta_policy_password / _default + okta_policy_rule_passwordYes (config)
Profile enrollmentokta_policy_profile_enrollment (+ rules/apps)Yes (config)
IdP discoveryokta_policy_rule_idp_discoveryYes (config)
Device assuranceokta_policy_device_assurance_*Yes (config)
Org authenticators / factorsokta_authenticator*, okta_factor, okta_factor_totpYes (config)
MFA enrollment already completed by a user—No

Authorization servers

Okta objectTerraform resourceCan be backed up
Authorization serverokta_auth_server, okta_auth_server_defaultYes (config)
Claims / scopes / policies / rulesokta_auth_server_claim(_default), _scope, _policy, _policy_ruleYes (config)

IdP, network, branding, hooks, org

Okta objectTerraform resourceCan be backed up
SAML / OIDC / social IdPokta_idp_saml, okta_idp_oidc, okta_idp_social (+ okta_idp_saml_key)Partial (keys/secrets)
Network zones / trusted origins / behavior / ThreatInsightokta_network_zone, okta_trusted_origin, okta_behavior, okta_threat_insight_settingsYes (config)
Brand / theme / sign-in pagesokta_brand, okta_theme, okta_customized_signin_page…Partial (the brand↔email_domain link is sometimes outside Terraform)
Custom domain + certificateokta_domain, okta_domain_certificate, okta_domain_verificationPartial (certs / DNS)
Email domain / sender / templates / SMSokta_email_*, okta_template_smsPartial / yes, depending on the object
Event / inline hooksokta_event_hook, okta_inline_hookPartial
API token / org settings / rate limits / captchaokta_api_token, okta_org_configuration, okta_rate_limiting…Partial
Feature flagsokta_featurePartial; importing feature settings: no
Custom admin roles / resource sets / realms / log streamsokta_admin_role_custom, okta_resource_set, okta_realm*, okta_log_stream…Yes (config) / partial

Clearly outside Terraform

Okta objectCan be backed up with Terraform
User passwordsNo
User MFA enrollments / devicesNo
Active sessionsNo
System Log / historyNo
Live AD/LDAP sync stateNo
Okta Workflows (full business logic)No
Configuration on third-party service providersNo
Full tenant transferNo

So if the answer remains "Terraform is not designed for backup and restore," you can still do useful things as part of an Okta backup policy. Your backup strategy simply cannot stop at Terraform (too many Okta objects are missing), and Terraform use in the organization has to be fully under control, to avoid the well-known drift and deviation effects with Okta.

Where to start if you want to use Terraform for disaster recovery

If you really want to use Terraform for backup, only the following objects are genuinely worth it: groups and group rules, authorization servers, policies and rules, OIDC/SAML apps (with secrets handled separately), group assignments, network zones, trusted origins, and schemas.

Useful but more fragile: branding, domains, emails, IdPs, hooks, tokens, and org settings.

Leave these out of a Terraform backup strategy: users, large-scale memberships, user factors, and system apps.

Conclusion

Terraform versions and redeploys the Okta configuration that the provider knows how to manage. That is useful, and it is incomplete. It cannot be your only Okta disaster-recovery solution.

"Git + remote state" protects the Terraform code and state. For a real tenant restore, point-in-time recovery, or a complete dependency graph, you need to consider a dedicated component, or to complement Terraform with specific scripts. Okta does not provide a native tenant transfer, and Terraform does not fully fill that gap.