Creating an Apply Rollback Job
Create an apply rollback job in Resource Manager.
When you create (run) an apply rollback job for a stack, Terraform provisions the resources and executes the action defined in the target job's Terraform configuration, applying the execution plan to the associated stack. This job rolls back your Oracle Cloud Infrastructure resources to a previous state.
We recommend creating (running) a plan rollback job (generating an execution plan) before running an apply rollback job, using the following flow.
-
Identify the successful apply job that you want to roll back to.
The job you want to roll back to is also known as the "target job."
-
Create a plan rollback job for the target job.
-
Confirm that the plan rollback job succeeded.
-
Confirm that the generated execution plan meets expectations.
-
Create an apply rollback job using the generated execution plan (
executionPlanRollbackStrategy
).Instructions are on this page.
The apply rollback job is created. The new job is listed under Jobs.
Use the
oci resource-manager job create-apply-rollback-job
command and required parameters to run an apply rollback job.oci resource-manager job create-apply-rollback-job --stack-id <stack_OCID> --execution-plan-rollback-strategy <source_of_execution_plan>
For a complete list of parameters and values for CLI commands, see the Command Line Reference for Resource Manager.
Use the CreateJob operation to create an apply rollback job.
For examples of details for an apply rollback job, see ApplyRollbackJobOperationDetails.
What's Next
Depending on the number and type of resources specified, a given apply rollback job can take some time.
After running an apply rollback job, get the job's details to check its status. You can optionally view the Terraform state file, view the logs, and confirm existence of provisioned resources.
Monitor the job status (lifecycle state) by getting the job's details. Succeeded (SUCCEEDED
) indicates that the job has completed. Depending on the complexity of the job, the operation can take some time. While the job runs, or after it finishes, you can get the job logs content.
To view the Terraform state file (shows the state of your resources after running the job), select the name of the job to display the Job details page, then select View state under Resources. Optionally select Show changes in this version.
To view the logs for the job, select the job to open its details page, then select Logs under Resources.
To confirm existence of newly provisioned resources, inspect resources in the compartment.