{"record":{"id":"9a068a6cd87aac40","repo":"hashicorp/terraform","slug":"error-using-a-saved-cloud-plan-when-executing-ter","errorCode":null,"errorMessage":"error: using a saved cloud plan when executing Terraform locally is not supported","messagePattern":"error: using a saved cloud plan when executing Terraform locally is not supported","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/local/backend_local.go","lineNumber":91,"sourceCode":"\t}\n\n\tret := &backendrun.LocalRun{\n\t\tPolicyClient: op.PolicyClient,\n\t}\n\n\t// Initialize our context options\n\tvar coreOpts terraform.ContextOpts\n\tif v := b.ContextOpts; v != nil {\n\t\tcoreOpts = *v\n\t}\n\tcoreOpts.UIInput = op.UIIn\n\tcoreOpts.Hooks = op.Hooks\n\tcoreOpts.TracingContext = ctx\n\n\tvar ctxDiags tfdiags.Diagnostics\n\tvar configSnap *configload.Snapshot\n\tif op.PlanFile.IsCloud() {\n\t\tdiags = diags.Append(fmt.Errorf(\"error: using a saved cloud plan when executing Terraform locally is not supported\"))\n\t\treturn ret, nil, nil, diags\n\t}\n\n\tif lp, ok := op.PlanFile.Local(); ok {\n\t\tvar stateMeta *statemgr.SnapshotMeta\n\t\t// If the statemgr implements our optional PersistentMeta interface then we'll\n\t\t// additionally verify that the state snapshot in the plan file has\n\t\t// consistent metadata, as an additional safety check.\n\t\tif sm, ok := s.(statemgr.PersistentMeta); ok {\n\t\t\tm := sm.StateSnapshotMeta()\n\t\t\tstateMeta = &m\n\t\t}\n\t\tlog.Printf(\"[TRACE] backend/local: populating backendrun.LocalRun from plan file\")\n\t\tret, configSnap, ctxDiags = b.localRunForPlanFile(op, lp, ret, &coreOpts, stateMeta)\n\t\tif ctxDiags.HasErrors() {\n\t\t\tdiags = diags.Append(ctxDiags)\n\t\t\treturn ret, nil, nil, diags\n\t\t}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/local/backend_local.go#L73-L109","documentation":"Returned by Local.localRun when op.PlanFile.IsCloud() is true. A cloud-saved plan (produced and stored by Terraform Cloud/Enterprise) can only be applied by the cloud backend; the local execution backend cannot execute it. This is a hard unsupported-operation guard, not a transient failure.","triggerScenarios":"Running terraform apply with a plan file that was saved to Terraform Cloud (e.g. via a cloud-backed plan run) while using a non-cloud (local or other) backend. The local backend's LocalRun path detects IsCloud() and aborts.","commonSituations":"Exporting/applying a plan generated in a TFC/TFE workspace locally; switching from cloud to local backend without regenerating the plan; CI that downloads a cloud plan and tries to apply it locally.","solutions":["Apply the cloud-saved plan from within Terraform Cloud/Enterprise (the cloud backend) instead of locally.","Generate a fresh local plan with terraform plan -out=tfplan and apply that locally with terraform apply tfplan.","Switch the configuration's backend to 'cloud' so the local CLI applies via the cloud run."],"exampleFix":"# before\nterraform plan -out=plan    # in TFC, then download and:\nterraform apply plan          # locally -> error\n# after (regenerate locally)\nterraform plan -out=tfplan\nterraform apply tfplan","handlingStrategy":"validation","validationCode":"// Reject cloud plan files before attempting local apply.\nif op.PlanFile.IsCloud() {\n    return errors.New(\"cannot apply a cloud-saved plan locally; apply via TFC/TFE or regenerate locally\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate plan files in the same backend context where you apply them.","Keep a clear separation between cloud-saved plans and local plan files.","Document which CI jobs must run via the cloud backend vs locally."],"tags":["plan","cloud","backend","unsupported","terraform"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}