Creating a Plan Rollback Job

Create a plan rollback job in Resource Manager.

Creating (running) a plan rollback job parses the Terraform configuration in the target job and converts it into an execution plan for the associated stack. The execution plan lists the sequence of specific actions planned to rollback your Oracle Cloud Infrastructure resources, including actions that are expected after running an apply rollback job.

We recommend running a plan rollback job (generating an execution plan) before running an apply rollback job, using the following flow.

  1. 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."

  2. Create a plan rollback job for the target job.

    Instructions are on this page.

  3. Confirm that the plan rollback job succeeded.

  4. Confirm that the generated execution plan meets expectations.

  5. Create an apply rollback job using the generated execution plan (executionPlanRollbackStrategy).

    The execution plan is handed off to the apply rollback job, which then executes the instructions.

    1. On the Stacks list page, select the stack that you want to work with. If you need help finding the list page or the stack, see Listing Stacks.
    2. In the Jobs list, find the apply job that you want to roll back to.
    3. From the Actions menu (Actions Menu) for the job, select Rollback.
      The Rollback panel opens, showing the OCID and name of the selected apply job (OCID of target rollback job and Name of target rollback job).
    4. For Rollback job type, select Plan to create a plan rollback job.
    5. (Optional) Edit the default name for the rollback job. Avoid entering confidential information.
    6. To generate detailed log content for debugging, select Show advanced options and select the log level that you want from Detailed log level.
      For more information, see Debugging Terraform.
    7. To adjust the maximum number of concurrent operations as Terraform walks the graph, select Show advanced options and edit the value for Maximum number of parallel operations. (Default: 10.) Use this option to speed up the job.
      Note

      A high value might cause throttling of resources. For example, consider a Terraform configuration that defines hundreds of compute instances. An Apply job attempts to create as many instances as possible at the same time. In this example, a value of 100 might cause throttling by the Compute service.
    8. To fetch the latest state before running the job, select Show advanced options and select Refresh resource states before checking for differences.

      Use this option to refresh the state first. For example, consider using this option with an Apply job that you intend to run on manually updated (existing) infrastructure.

      Note

      Refreshing the state can affect performance. If the configuration includes several resources, consider not using this option.
    9. (Optional) Select Show advanced options and assign tags to the job.
      • Tag namespace: To add a defined tag, select an existing namespace. To add a free-from tag, leave the value blank.
      • Tag key: To add a defined tag, select an existing tag key. To add a free-form tag, type the key name that you want.
      • Tag value: Type the tag value that you want.
      • Add tag: Click to add another tag.
    10. Select Ok.

    The plan rollback job is created. The new job is listed under Jobs.

  • Use the oci resource-manager job create-plan-rollback-job command and required parameters to run a plan rollback job.

    oci resource-manager job create-plan-rollback-job --stack-id <stack_OCID> --target-rollback-job-id <job_OCID>

    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 a plan rollback job.

    For examples of details for a plan rollback job, see PlanRollbackJobOperationDetails.