{"record":{"id":"326253f0159a196e","repo":"hashicorp/terraform","slug":"errrunapproved","errorCode":"errRunApproved","errorMessage":"approved using the UI or API","messagePattern":"approved using the UI or API","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"internal/cloud/errors.go","lineNumber":19,"sourceCode":"// Copyright IBM Corp. 2014, 2026\n// SPDX-License-Identifier: BUSL-1.1\n\npackage cloud\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/hashicorp/terraform/internal/tfdiags\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\n// String based errors\nvar (\n\terrApplyDiscarded                    = errors.New(\"Apply discarded.\")\n\terrDestroyDiscarded                  = errors.New(\"Destroy discarded.\")\n\terrRunApproved                       = errors.New(\"approved using the UI or API\")\n\terrRunDiscarded                      = errors.New(\"discarded using the UI or API\")\n\terrRunOverridden                     = errors.New(\"overridden using the UI or API\")\n\terrApplyNeedsUIConfirmation          = errors.New(\"Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.\")\n\terrPolicyOverrideNeedsUIConfirmation = errors.New(\"Cannot override soft failed policy checks when -input=false. Please open the run in the UI to override.\")\n)\n\n// Diagnostic error messages\nvar (\n\tinvalidWorkspaceConfigMissingValues = tfdiags.AttributeValue(\n\t\ttfdiags.Error,\n\t\t\"Invalid workspaces configuration\",\n\t\tfmt.Sprintf(\"Missing workspace mapping strategy. Either workspace \\\"tags\\\" or \\\"name\\\" is required.\\n\\n%s\", workspaceConfigurationHelp),\n\t\tcty.Path{cty.GetAttrStep{Name: \"workspaces\"}},\n\t)\n\n\tinvalidWorkspaceConfigMisconfiguration = tfdiags.AttributeValue(\n\t\ttfdiags.Error,\n\t\t\"Invalid workspaces configuration\",","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/errors.go#L1-L37","documentation":"A sentinel error used internally by the cloud backend to signal that a run was approved externally (via TFC/TFE UI or API) while the CLI was waiting for local interactive confirmation. In backend_common.go:478-479 it is set when the run's Actions.IsConfirmable becomes false and status is not RunDiscarded. Crucially, this error is NOT fatal — backend_apply.go:170 and :187 explicitly check 'err != errRunApproved' to allow the apply to proceed when the run was confirmed out-of-band.","triggerScenarios":"During 'terraform apply' with a cloud backend, while the CLI shows the confirmation prompt, someone clicks 'Confirm & Apply' in the Terraform Cloud UI or approves via API. The polling goroutine detects Actions.IsConfirmable == false and returns errRunApproved instead of waiting for local input.","commonSituations":"A team lead approves a run in the TFC UI while the developer who ran 'terraform apply' is still reviewing the plan locally; an automation system approves via API while a human-initiated CLI apply is in progress.","solutions":["No fix needed — this is informational; the apply continues normally because the run was approved externally.","If you want to prevent external approvals during CLI sessions, use workspace locks or coordinate approval timing.","If you prefer CLI-only confirmation, avoid approving runs in the UI while a CLI apply is in progress."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// This error is non-fatal — the cloud backend already handles it internally.\n// If wrapping terraform, check for it and treat as success:\n// if errors.Is(err, cloud.ErrRunApproved) { /* run approved externally, proceed */ }","preventionTips":["Do not treat this as an error in automation — it means the run succeeded via external approval.","Use workspace locks if you need strict serialization of approval actions.","Document team workflows for who approves runs (UI vs CLI) to avoid confusion."],"tags":["terraform","cloud","apply","run-lifecycle","confirmation","concurrency"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}