Managing Stacks and Jobs

This topic describes how to create, edit, and delete stacks as well as work with jobs, including generating and applying execution plans. Drift detection is also covered in this topic.

Warning

Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.

Prerequisites

  • IAM policies: To manage stacks and jobs, you must be given the required type of access in a policy  written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which compartment  you should work in.

    Administrators: For common policies that give groups access to stacks and jobs, see Policies for Managing Stacks and Jobs. For a complete list of Resource Manager permissions, see Details for Resource Manager. Policies for managing accessed resource types are also required.

    Important

    Policies for managing Oracle Cloud Infrastructure resources are also required for Resource Manager operations that access resources. For example, running an apply job on a stack that includes Compute instances and subnets requires policies that grant you permissions for those resource types, in the compartments where you want to provision the resources. To see examples of policies for managing Oracle Cloud Infrastructure resources, see Common Policies.
  • Terraform configuration file: To create or update a stack, you must have a valid Terraform configuration file. See Terraform Configurations for Resource Manager and Writing Terraform Configurations.

Tagging Resources

You can apply tags to your resources to help you organize them according to your business needs. You can apply tags at the time you create a resource, or you can update the resource later with the desired tags. For general information about applying tags, see Resource Tags.

Moving Resources to a Different Compartment

You can move stacks from one compartment to another. When you move a stack to a new compartment, its associated jobs move with it. After you move the stack to the new compartment, inherent policies apply immediately and affect access to the stack and associated jobs through the Console. For more information, see Managing Compartments.

Using the Console

Managing Stacks (Console)

To create a stack (solution)

Use a sample solution to provision cloud resources used in a common scenario. Creating a stack from a solution involves selecting the solution, providing identifying information for the new stack, and optionally updating variables. You can always edit your stack later.

Solutions are available using the Console only.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click Create Stack.
  4. In the Create Stack dialog, click Sample Solution.
  5. Under Stack Configuration, click Select Solution and then select the sample you want.
  6. Enter a Name for the new stack (or accept the default name provided).
  7. Optionally enter a Description.
  8. From the Create in Compartment drop-down, select the compartment where you want to create the stack.

    A compartment from the list scope is set by default.

  9. Optionally, you can apply tags. If you have permissions to create a resource, you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, skip this option (you can apply tags later) or ask your administrator.
  10. Click Next.

    The Configure Variables panel displays variables from the Terraform configuration for the selected solution.

  11. Review the variables and make changes as necessary.

    Important

    Do not add your private key or other confidential information to configuration variables.
  12. Click Next.
  13. In the Review panel, verify your stack configuration.
  14. Click Create to create your stack.

To deploy the resources defined in the solution, run an apply job on your new stack.

To create a stack from a file

Creating a stack involves referencing your Terraform configuration file (by upload or source code control system), providing identifying information for the new stack, and optionally updating variables. You can always edit your stack later.

Important

Ensure your Terraform configuration file is valid. See Writing Terraform Configurations and Terraform Configurations for Resource Manager.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click Create Stack.
  4. In the Create Stack dialog, select the option related to the location of your Terraform configuration.
    • My Configuration: Locally accessed file you want to upload.

      You can either drag and drop it onto the dialog's control or click Browse and navigate to the file location.

      The dialog box is populated with information contained in the configuration file.

    • Source Code Control System: Remote, versioned file you want to reference.

      See Prerequisites for connecting to GitLab.

  5. For a remote, versioned file (Source Code Control System), do the following:

    1. Select a Configuration Source Provider.

      If you need to create one, see To create a configuration source provider.

    2. Select a Repository.

      Example: https://gitlab.com/example

    3. Select a Branch.

      The list returned is limited to 100 branches.

    4. (Optional) Specify a Working Directory for running Terraform.

      Example (one level): Directory

      Example (two levels): Directory/Subdirectory

      If not specified, the root directory is used.

  6. Enter a Name for the new stack (or accept the default name provided).
  7. Optionally enter a Description.
  8. From the Create in Compartment drop-down, select the compartment where you want to create the stack.

    A compartment from the list scope is set by default.

  9. Select a Terraform Version.

    Note

    Terraform version 0.12.x is not backward-compatible.
  10. Optionally, you can apply tags. If you have permissions to create a resource, you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, skip this option (you can apply tags later) or ask your administrator.
  11. Click Next.

    The Configure Variables panel displays variables from the selected Terraform configuration file.

  12. Review the variables and make changes as necessary.

    Important

    Do not add your private key or other confidential information to configuration variables.
  13. Click Next.
  14. In the Review panel, verify your stack configuration.
  15. Click Create to create your stack.
To discover resources (create a stack from a compartment)
Note

You must have READ permissions for the resources you want to discover. For more information, see Policies for Managing Stacks and Jobs.

Capture resources in a compartment by creating a stack from that compartment. The created stack includes a Terraform configuration file and state file describing the resources in the compartment, allowing you to manage these resources with Resource Manager.

A stack created from a compartment represents all supported resources in the entire compartment, at the appropriate scope. If you select the root compartment for your tenancy, then the scope is the tenancy level, such as users and groups. If you select a non-root compartment, then the scope is compartment level, such as Compute instances.

Stack creation is supported from a single compartment only. Stacks cannot be created from nested compartments.

Creating a stack from an existing compartment involves selecting the compartment and providing identifying information for the new stack. You can always edit your stack later.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks or Jobs.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click Create Stack.
  4. Under Choose the origin of the Terraform configuration, select Existing Compartment.
  5. Fill in the fields for this origin type:
    • Select the Compartment for Resource Discovery (the compartment containing the resources that you want to capture).

      A compartment from the list scope is set by default.

    • Select the Region for Resource Discovery (the region containing the resources that you want to capture).
    • To filter for specific Terraform provider services supported for use with resource discovery, select Selected and then select the services you want.

      Note

      This setting cannot be changed when editing the stack later.
    • Enter a Name for the new stack (or accept the default name provided).
    • Optionally enter a Description.
    • From the Create in Compartment drop-down, select the compartment where you want to create the stack.

      A compartment from the list scope is set by default.

    • Optionally, you can add tags. If you have permissions to create a resource, you also have permissions to add free-form tags to that resource. To add a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should add tags, skip this option (you can add tags later) or ask your administrator.
  6. Click Next.
  7. In the Configure Variables panel, click Next.

    No variables are listed because no configuration file is generated yet.

  8. In the Review panel, verify your stack configuration.
  9. Click Create to create your stack.

    The stack detail page for the new stack appears. A work request runs on your stack. When the work request finishes, a job runs to generate a Terraform configuration file for the stack. When the job finishes, the resources in the selected compartment are captured in the generated configuration.

To see how Terraform represents your resources

Learn how Terraform uses HashiCorp Configuration Language (HCL) syntax to represent Oracle Cloud Infrastructure resources.

  1. Capture existing infrastructure by creating a stack from that compartment .

    The stack detail page for the new stack appears. A work request runs on your stack. When the work request finishes, a job runs to generate a Terraform configuration file for the stack. When the job finishes, the resources in the selected compartment are captured in the generated configuration.

  2. Download the generated Terraform configuration file: In the Stack Information tab of the stack detail page, click Download.
To recreate (clone) existing infrastructure in another compartment
  1. Capture existing infrastructure by creating a stack from that compartment.

    The stack detail page for the new stack appears. A work request runs on your stack. When the work request finishes, a job runs to generate a Terraform configuration for the stack. When the job finishes, the resources in the selected compartment are captured in the generated configuration.

  2. Download the generated Terraform configuration file: In the Stack Information tab of the stack detail page, click Download.
  3. Edit the variables.tf file (variables in the configuration file) to specify the destination compartment_ocid and region.

    Example:

    variable "compartment_ocid" {
                            default = "ocid1.compartment.oc1..uniqueid"
                            }
                            
                            variable "region" {
                            default = "us-phoenix-1"
                            }
  4. Create a second stack using the edited configuration file.

    1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
    2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

    3. Click Create Stack.
    4. In the Create Stack dialog, click My Configuration.
    5. Add the downloaded Terraform configuration (.zip) file.

      You can leave other fields as is for now. For reference, see To discover resources (create a stack from a compartment) .

    6. For Terraform Version, select 0.12.x.
    7. Click Next to display the Configure Variables panel.
    8. Update the compartment_ocid variable to specify the destination compartment for the cloned resources.
    9. If you want to clone the resources to a different region, update the region variable.
    10. Click Next to display the Review panel.
    11. Click Create to create your stack.

      The stack detail page for the second stack appears.

  5. To confirm that the stack will create resources as expected, run a plan job.
  6. Clone resources: Run an apply job on the new stack.

    The resources are cloned in the specified compartment and region.

To view stacks

You can view stack names, descriptions, states, and time created. The detail page for a stack lists its drift status and allows you to view the latest drift detection report.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. To display the detail page for a stack, click the stack's name.
To download the stack's Terraform configuration file

The Terraform configuration file listed on the stack detail page is the same as the Terraform configuration file listed on the job detail page for the most recent successful job.

Note

For stacks created using source code control systems, configuration files are not available for download until a job is successfully run on the stack.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack to display its detail page.
  4. In the Stack Information tab, to the right of Terraform Configuration File (.zip), click Download.
To detect drift for a stack

You can detect drift for stacks where the last job run was Apply or Import State.

Drift is the difference between the actual, real-world state of your infrastructure and the stack's last executed configuration. For example, drift occurs when a team member adds a production tag to your resources, or when a resource fails.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack to display its detail page.
  4. Go to More Actions and select Run Drift Detection.

    Alternatively go to the Stack Information tab. Under Drift Detection, click Run drift detection now.

    When the work request is complete, the drift status appears in the Stack Information tab.

To view a drift detection report
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack to display its detail page.
  4. Go to More Actions and select View Drift Detection Report.

    Alternatively go to the Stack Information tab. Under Drift Detection, click View drift detection report.

    A panel lists the drift status of each resource defined by the stack.

  5. To view details of drift status for a resource, click the down arrow.

    Expected and actual properties are listed.

  6. (Optional) To make your resources match the properties of your Terraform configuration, run an apply job: In the Stack Details page, go to Terraform Actions and select Apply.
To edit a stack

You can edit stacks. When editing a stack, you can upload a different configuration and change its name, description, Terraform version, and variables.

Note

If your configuration is stored in a source code control system, such as GitLab, then commit your changes there. The most recent commit is used when you run jobs on the stack. No configuration file is available for download until a job is successfully run on the stack.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the Actions icon (three dots), and then select Edit.

    You can also edit a stack from its detail page. Click the name of the stack to display its detail page and then click Edit Stack.

  4. In the Edit Stack dialog, change the properties you want.
    Note

    Changing the Terraform version requires the stack's Resource Manager configuration to be compatible with the new version. Downgrading the Terraform version from 0.12.x to 0.11.x is only available before an apply job is run on the stack.
    • To edit the values assigned to variables in a stack, click Configure Variables.

      You can also edit a stack from its detail page. Click the name of the stack to display the Stack Details page, click Variables (under Resources) and then click Edit Variables.

      Important

      Do not add your private key or other confidential information to configuration variables.

      If you want to add, reconfigure, or delete variables in a stack, update the Terraform configuration.

  5. Click Save Changes.
To view the state of a stack

Download the state file corresponding to the most recently run job for the stack.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack to display its detail page.
  4. Go to More Actions and select Download Terraform State.
To manage tags for a stack

Tags are key/value pairs that you can attach to resources to help you organize and track your resources across compartments. If you have permissions to create a resource, you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, skip this option (you can apply tags later) or ask your administrator.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack you want.

    The Stack Details page lists the details about the selected job.

  4. Click Tags to view or edit existing tags, or click Add Tags to add new ones.
To move a stack to a different compartment
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the Actions icon (three dots), and then select Move Stack.

    You can also move a stack from its detail page. Click the name of the stack to display the Stack Details and then click Move Stack.

  4. In the Move Resource To A Different Compartment dialog box, select the compartment that you want to move the stack to.
  5. Click Move Resource.
To delete a stack
Note

Associated resources persist after stack deletion. When you delete a stack, its associated state file is also deleted; therefore, you lose track of the state of its associated resources. Cleaning up resources associated with a deleted stack can be difficult without the state file, especially when those resources are spread across multiple compartments. To avoid difficult cleanup later, we recommend that you release associated resources first by running a destroy job.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the Actions icon (three dots), select Delete, and confirm the operation when prompted.

    Note

    You cannot undo the delete stack operation.

    You can also delete a stack from its detail page. Click the name of the stack to display the Stack Details and then click Delete Stack.

Managing Jobs (Console)

To view jobs and job details

You can view name, type, status, and other key information about jobs for a given compartment or stack. You can view name, type, status, and other key information about a given job. You can also access the job's execution plan (represented by the job log), Terraform configuration, and Terraform state, as well as view the variables used in the job.

For configurations stored in a source code control system, such as GitLab, job details include the relevant commit identifier.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Jobs.

    You can also access jobs from a stack detail page. Click Stacks and then click the name of the stack you want.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. To view job details, click the name of the job you want.

    The Job Details page lists the details about the selected job.

  4. To view variables used in the job, click Variables under Resources.
To manage tags for a job

Tags are key/value pairs that you can attach to resources to help you organize and track your resources across compartments. If you have permissions to create a resource, you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure if you should apply tags, skip this option (you can apply tags later) or ask your administrator.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Jobs.

    You can also access jobs from a stack detail page. Click Stacks and then click the name of the stack you want.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the job you want.

    The Job Details page lists the details about the selected job.

  4. Click Tags to view or edit existing tags, or click Add Tags to add new ones.
To generate an execution plan (run a plan job)

Running a plan job parses your Terraform configuration and converts it into an execution plan listing resources and actions that will result when an apply job is run. For configurations stored in a source code control system, such as GitLab, the job uses the most recent commit. We recommend generating an execution plan before running an apply job.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack that you want to use.

    The Stack Details page is displayed.

  4. Go to Terraform Actions and select Plan.

  5. In the Plan dialog, review the plan job Name and update it if needed.
  6. Click Plan.

    The new plan job is listed under Jobs, with an initial state of "Accepted." Soon the status changes to "In Progress." When the job is complete, you can review the execution plan or download the job information.

To view the job log
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Jobs.

    You can also access jobs from a stack detail page. Click Stacks and then click the name of the stack you want.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the plan job that you ran.

  4. On the Job Details page, under Resources, click Logs.

    For plan jobs, the log file is the execution plan. View the log file for the plan job and note the "message" fields in the sequence of log entries of the log file. These values represent the sequence of operations specified in your configuration.

    You can also download the job information.

To update the configuration for a stack
Important

Ensure that your Terraform configuration file is valid. See Writing Terraform Configurations and Terraform Configurations for Resource Manager.
Note

If your configuration is stored in a source code control system, such as GitLab, then commit your changes there. The most recent commit is used when you run jobs on the stack.
  1. Ensure you have your revised Terraform configuration (.zip) file ready for upload.

    To edit a configuration file that was generated from a sample solution, first download the configuration. Then use the edited configuration file for the update.

  2. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  3. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  4. Click the name of the stack that you want to update.

    The Stack Details page is displayed.

  5. In the Stack Information tab, next to Terraform Configuration File (.zip), click Upload New.
  6. In the Edit Stack dialog, add your revised Terraform configuration (.zip) file.

    You can either drag and drop it onto the dialog's control or click Browse and navigate to the file location.

    The dialog box is populated with information contained in the configuration file.

  7. Click Next as needed and then click Save Changes.

    Now you can generate a new execution plan using your revised configuration.

To download job information

You can download files associated with jobs: Terraform configurations, Terraform states, and logs.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Jobs.

    You can also access jobs from a stack detail page. Click Stacks and then click the name of the stack you want.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the job you want.

    The Job Details page appears.

    You can view the log by clicking Logs under Resources.

    You can view the state of your resources (for relevant jobs) by clicking View State under Resources.

  4. Download the job information you want: 

    To download this job-associated file Click
    Terraform configuration (.zip file) Download Terraform Configuration
    Terraform state (.json file) Download Terraform State
    Logs (.txt file) Download Logs (Logs section under Resources)
To run an apply job

When you run an apply job for a stack, Terraform creates the resources and executes the actions defined in your Terraform configuration. For configurations stored in a source code control system, such as GitLab, the job uses the most recent commit. The time required to complete an apply job depends on the number and type of cloud resources to be created.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack that you want to use.

    The Stack Details page is displayed.

  4. Go to Terraform Actions and select Apply.

  5. In the Apply dialog, review the apply job Name and other settings and update it if needed.
  6. Click Apply.

    The new apply job is listed under Jobs. Monitor its status: "Succeeded" indicates that the job has completed. While the job runs, or after it completes, you can download its log file.

  7. To view the Terraform state file (shows the state of your resources after running the job), click the name of the apply job and then click View State under Resources.

To view the state of a job
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Jobs.

    You can also access jobs from a stack detail page. Click Stacks and then click the name of the stack you want.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the job you want.
  4. On the Job Details page, click View State under Resources.
To import an existing Terraform state file (run an import job)

You can import state files for existing resources already managed by Terraform.

  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack that you want to use.

    The Stack Details page appears.

  4. Go to Terraform Actions and select Import State.

  5. In the Import State File dialog, review the job Name and update it if needed.
  6. Add your Terraform state file, either by dragging and dropping it onto the dialog's control, or by clicking Browse and navigating to the file location.
  7. Click Import.
To release a stack's resources (run a destroy job)

Run a destroy job to tear down the resources and clean up the tenancy.

Note

We recommend running a destroy job before deleting a stack to release associated resources first. When you delete a stack, its associated state file is also deleted; therefore, you lose track of the state of its associated resources. Cleaning up resources associated with a deleted stack can be difficult without the state file, especially when those resources are spread across multiple compartments. To avoid difficult cleanup later, we recommend that you release associated resources first by running a destroy job.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Stacks.
  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the stack that you want to use.

    The Stack Details page is displayed.

  4. Go to Terraform Actions and select Destroy.
  5. Click Destroy again to confirm your action.

    You can monitor the status and review the results of a destroy job by viewing the state or the logs.

  6. To view the Terraform state file (shows the state of your resources after running the job), click the name of the job to display the Job Details page, then click View State under Resources.
  7. To view the logs for the job, click the name of the job to display the Job Details page, then click Logs under Resources.

Managing Configuration Source Providers (Console)

Use configuration source providers to store Terraform configuration files in source code control systems. You can then reference those stored files when you create stacks. Supported options:

  • GitLab: Supports the following products: 
    • GitLab Community Edition
    • GitLab Enterprise Edition
    • GitLab.com

Limitations: 

  • Supports GitLab only, with authentication by Personal Access Token only.
  • Only the latest commit information is available. (No history is available.)
Prerequisites for connecting to GitLab

Following are the prerequisites to connect Oracle Cloud InfrastructureResource Manager to GitLab.

  • Your GitLab server must be accessible over the Internet by Oracle Cloud Infrastructure IP addresses. (This accessibility requirement does not apply to GitLab.com.) 
    • Make sure Resource Manager can resolve your GitLab URL. Make sure that your GitLab server is deployed with a well-known root certificate, such as digicert, so that Oracle Cloud Infrastructure can trust its endpoint.
    • Configure your network to allow access from Oracle Cloud Infrastructure IP address ranges. Ensure that you include ranges for all relevant services, including the Oracle Services Network (tag: OSN).
    • Enable network ingress rules on the VCN where your GitLab server is deployed to allow access from Oracle Cloud Infrastructure IP addresses.
  • You must have GitLab admin or owner permissions for the repository.
  • You must have a Personal Access Token (PAT) to your GitLab server. The scope read_api is required for use with Resource Manager. For security, we recommend excluding write_repository scope.

    To create a PAT, see the GitLab documentation at https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html.

  • You must have Resource Manager permissions required for your task:
    • To create a configuration source provider, you need manage orm-config-source-providers.
    • To create a stack with an existing configuration source provider, you need manage orm-stacks and read orm-config-source-providers.

      For more information, see Policies for Managing Stacks and Jobs.

For troubleshooting information, see GitLab Connection Issues.

To create a configuration source provider
Important

To connect to GitLab, you must use a Personal Access Token. See Prerequisites for connecting to GitLab.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Configuration Source Providers.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click Create Configuration Source Provider.
  4. In the Create Configuration Source Provider panel, do the following.
    • Type a Name for your configuration source provider.
    • Type a Description.
    • Select the Compartment where you want to create the configuration source provider.
    • Select the Type of configuration source provider you want. Choose from the following options.

      • GitLab: Supports the following products: 
        • GitLab Community Edition
        • GitLab Enterprise Edition
        • GitLab.com
    • Paste the GitLab URL.

      Example URLs:

      https://gitlab.example.com/ - GitLab installation (subdomain)

      https://example.com/gitlab - GitLab installation (relative URL)

      https://gitlab.com/ - GitLab.com product

    • Paste the Personal Access Token.
    • To tag the new configuration source provider, click Show Advanced Options and add your tag.

    For troubleshooting information, see GitLab Connection Issues.

  5. Click Create.
To edit a configuration source provider
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Configuration Source Providers.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the configuration source provider that you want to edit.
  4. Click Edit Configuration Source Provider.
  5. In the Edit Configuration Source Provider dialog box, update property values as needed.

    For troubleshooting information, see GitLab Connection Issues.

  6. Click Save.
To delete a configuration source provider
Note

A configuration source provider cannot be deleted if it is associated with a stack. To remove the association from the stack, edit the stack.
  1. Open the navigation menu. Under Solutions and Platform, go to Resource Manager and click Configuration Source Providers.

  2. Choose a compartment you have permission to work in (on the left side of the page). The page updates to display only the resources in that compartment. If you're not sure which compartment to use, contact an administrator.

  3. Click the name of the configuration source provider that you want to delete.
  4. Click Delete Configuration Source Provider and then confirm the action.

Using the CLI

This section provides basic sample CLI commands for managing stacks and jobs. For information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see CLI Help.

Managing Stacks (CLI)

To create a stack from a file (CLI)

Use the command related to your file location.

Important

Ensure your Terraform configuration file is valid. See Writing Terraform Configurations and Terraform Configurations for Resource Manager.
To create a stack from a file hosted on a source code control system

Open a command prompt and run resource-manager stack create-from-git-provider to create a stack from a file tracked with a configuration source provider: 

oci resource-manager stack create-from-git-provider --compartment-id <compartment_OCID> --config-source-configuration-source-provider-id <configuration_source_provider_OCID> --config-source-repository-url <repository_url> --config-source-branch-name <branch_name> --display-name "<friendly_name>" --description "<description>" --terraform-version "<version>" --variables <var_file_path> --working-directory "<directory>"
Note

You can return later to update stack settings or add variables after you have created the stack.

For a complete list of flags and options available for CLI commands, see CLI Help.

For example: 

oci resource-manager stack create-from-git-provider --compartment-id ocid1.tenancy.oc1..uniqueid --config-source-configuration-source-provider-id ocid.ormconfigsourceprovider.oc1..uniqueid --config-source-repository-url https://github.com/user/repo.git --config-source-branch-name mybranch --display-name "My Stack from Git" --description "My Test" --variables file://variables.json --working-directory ""
To create a stack from an uploaded file

This section describes how to create a stack from an uploaded configuration file (.zip).

Note

You can also create stacks from configuration files stored in source code control systems, such as Git, and from sample solutions.

On Windows, be sure the .zip file and variables.json files are in the same directory from which you're running the CLI. The CLI currently has a limitation on Windows that prevents correct handling of the files if either one is in a subdirectory.

Open a command prompt and run oci resource-manager stack create to create a stack: 

oci resource-manager stack create --compartment-id <compartment_OCID> --config-source <config_file_name> --variables <var_file_path> --display-name "<friendly_name>" --description "<description>" --working-directory ""
Note

You can return later to update stack settings or add variables after you have created the stack.
Options

For a complete list of flags and options available for CLI commands, see CLI Help.

  • --compartment-id is the OCID of the compartment where you want to create the stack.
  • --config-source is the name of a .zip file that contains one or more Terraform configuration files.
  • --variables is the path to the file specifying input variables for your resources. Optional.

    The Oracle Cloud Infrastructure Terraform provider requires additional parameters when running Terraform locally (unless you are using instance principals). For more information on using variables in Terraform, see Input Variables. See also Input Variable Configuration.

  • --display-name is the friendly name for the new stack. Optional.
  • --description is the description for the new stack. Optional.
  • --working-directory is the root configuration file in the directory. Optional. If not specified, or if null as in this example, then the service assumes that the top-level file in the directory is the root configuration file.

For example: 

oci resource-manager stack create --compartment-id ocid1.tenancy.oc1..uniqueid --config-source vcn.zip --variables file://variables.json --display-name "My Example Stack" --description "My Tutorial to Create a VCN" --working-directory ""
Example response
{
                        "data": {
                        "config-source": {
                        "working-directory": null,
                        "config-source-type": "ZIP_UPLOAD"
                        },
                        "defined-tags": {},
                        "description": "My Tutorial to Create a VCN",
                        "display-name": "My Example Stack",
                        "freeform-tags": {},
                        "id": "ocid1.ormstack.oc1..uniqueid",
                        "lifecycle-state": "ACTIVE",
                        "time-created": "2019-04-03T18:26:56.299000+00:00",
                        "variables": {
                        "compartment_ocid": "ocid1.compartment.oc1..uniqueid", 
                        "region": "us-phoenix-1"
                        }
                        }
                        }
To discover resources (create a stack from a compartment)

Open a command prompt and run oci resource-manager stack create-from-compartment to create a stack from the specified compartment and region:

oci resource-manager stack create-from-compartment --config-source-compartment-id <source_compartment_OCID> --config-source-region <source_region> --config-source-services-to-discover [<services>] –-compartment-id <compartment_OCID> --terraform-version <version --display-name "<friendly_name>" --description "<description>" 

For example (discovers resources from the core and databaseTerraform provider services; the source compartment is not a root compartment):

oci resource-manager stack create-from-compartment --config-source-compartment-id ocid1.tenancy.oc1..uniqueid1 --config-source-region PHX --config-source-services-to-discover [core,database] –-compartment-id ocid1.tenancy.oc1..uniqueid2 --terraform-version 0.12.X --display-name "Stack From Compartment ABC" --description "List of Resources to Duplicate"
Example response
{
  "data": {
    "config-source": {
      "config-source-type": "COMPARTMENT_CONFIG_SOURCE"
    },
    "defined-tags": {},
    "display-name": "Stack from Compartment ABC",
    "freeform-tags": {},
    "id": "ocid1.ormstack.oc1..uniqueid",
    "lifecycle-state": "CREATING",
    "time-created": "2019-04-03T18:26:56.299000+00:00",
    "variables": {
      "compartment_ocid": "ocid1.compartment.oc1..uniqueid1", 
      "region": "us-phoenix-1"
    }
  }
}
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..uniqueid2",
    "config-source": {
      "compartment-id": "ocid1.compartment.oc1..uniqueid1",
      "config-source-type": "COMPARTMENT_CONFIG_SOURCE",
      "region": "PHX",
      "working-directory": null
    },
    "defined-tags": {},
    "description": "List of Resources to Duplicate",
    "display-name": "Stack From Compartment ABC",
    "freeform-tags": {},
    "id": "ocid1.ormstack.oc1.phx.uniqueid",
    "lifecycle-state": "CREATING",
    "stack-drift-status": "NOT_CHECKED",
    "terraform-version": "0.12.x",
    "time-created": "2020-06-01T18:25:56.102000+00:00",
    "time-drift-last-checked": null,
    "variables": {}
  },
  "etag": "009010cb57f5162655c6a34f5ef8834f204a734df81e4baa696a7d830488ea25",
  "opc-work-request-id": "ocid1.ormworkrequest.oc1.phx.uniqueid"
}
To list resources for discovery

This section describes how to determine which services are supported for resource discovery from a given compartment OCID.

When you create a stack from a compartment, the stack represents all supported resources in the entire compartment, at the appropriate scope. If you select the root compartment for your tenancy, then the scope is the tenancy level, such as users and groups. If you select a non-root compartment, then the scope is compartment level, such as Compute instances.

Open a command prompt and run oci resource-manager stack list-resource-discovery-services to retrieve a list of services supported for resource discovery (the compartment OCID is used for authorization only):

oci resource-manager stack list-resource-discovery-services --compartment-id <compartment_OCID>
To list stacks in a compartment

Open a command prompt and run oci resource-manager stack list to list the stacks in a compartment: 

oci resource-manager stack list –-compartment-id <compartment_OCID>
To list full details of a stack

Open a command prompt and run oci resource-manager stack get to list the details for the specified stack: 

oci resource-manager stack get –-stack-id <stack_OCID>
To detect drift for a stack

Open a command prompt and run oci resource-manager stack get to detect drift for the specified stack: 

oci resource-manager stack detect-drift --stack-id <stack_OCID>
To list resource details in the stack's last drift detection report

Open a command prompt and run oci resource-manager stack get to list the resource details for the last drift detection report of a specified stack: 

oci resource-manager stack list-resource-drift-details --stack-id <stack_OCID>
To delete a stack
Note

Associated resources persist after stack deletion. When you delete a stack, its associated state file is also deleted; therefore, you lose track of the state of its associated resources. Cleaning up resources associated with a deleted stack can be difficult without the state file, especially when those resources are spread across multiple compartments. To avoid difficult cleanup later, we recommend that you release associated resources first by running a destroy job.

Open a command prompt and run oci resource-manager stack delete to delete the specified stack: 

oci resource-manager stack delete –-stack-id <stack_OCID>

Managing Jobs (CLI)

To generate an execution plan (run a plan job)

Open a command prompt and run oci resource-manager job create-plan-job to run a plan job on the specified stack (--display-name is optional): 

oci resource-manager job create-plan-job –-stack-id <stack_OCID> --display-name "<friendly_name>"

Depending on the complexity of the configuration, the plan job can take several minutes to complete. When the job is complete, make sure you review the generated execution plan before running an apply job.

To check the current state of the plan job

Open a command prompt and run oci resource-manager job get to retrieve information about the job: 

oci resource-manager job get –-job-id <plan_job_OCID>
Lifecycle states
Possible values for lifecycle-state:
  • ACCEPTED: The job is queued for execution.
  • IN_PROGRESS: The job is running.
  • FAILED: The job has failed and stopped running.
  • SUCCEEDED: The job has completed successfully.
  • CANCELING: The job has been notified to cancel, but has not yet stopped running.
  • CANCELED: The job was canceled and has stopped running.
Example response

This example shows ACCEPTED for lifecycle-state.

{
                                    "data": {
                                    "compartment-id": " ocid1.compartment.oc1..uniqueid",
                                    "defined-tags": null,
                                    "display-name": "Example Plan Job",
                                    "freeform-tags": {},
                                    "id": "ocid1.ormjob.oc1..uniqueid",
                                    "lifecycle-state": "ACCEPTED",
                                    "operation": "PLAN",
                                    "jobOperationDetails": {
                                    "operation": "PLAN"
                                    },
                                    "stack-id": " ocid1.ormstack.oc1..uniqueid",
                                    "time-created": "2019-03-09T20:52:13.922000+00:00",
                                    "time-finished": null,
                                    "variables": {
                                    "compartment_ocid": "ocid1.compartment.oc1..uniqueid",
                                    "region": "us-phoenix-1"
                                    }
                                    }
                                    }
To review an execution plan (view the log for a plan job)

Review the execution plan to ensure that it accurately reflects your intentions. View the log file and note the "message" fields in the sequence of log entries of the log file. These values represent the sequence of operations specified in your configuration.

Open a command prompt and run oci resource-manager job get-job-logs to view the log file for the specified job: 

oci resource-manager job get-job-logs --job-id <plan_job_OCID>

If you see problems or errors and wish to make changes, then update the appropriate configuration file (.tf file), update the stack to use the revised configuration, generate a new execution plan, and then review the new execution plan.

Example response

The command returns JSON objects that describe log entries. Each object has a message member with a property that displays one line of the execution plan. In the example shown below, the plan creates a single virtual cloud network (VCN); the remaining members show details about the VCN.

...
                {
                "level": "INFO",
                "message": "Terraform will perform the following actions:",
                "timestamp": "2018-05-24T00:57:14.170000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "",
                "timestamp": "2018-05-24T00:57:14.170000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "+ oci_core_virtual_network.vcn1",
                "timestamp": "2018-05-24T00:57:14.170000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "id: <computed>",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "cidr_block:  \"10.0.0.0/16\",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "compartment_id:  \"ocid1.tenancy.oc1..exampleaqnpcpfqfmrf6dw5gcew7yqpirvarueirj2mv4jzn5goejsxma\",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "default_dhcp_options_id:  <computed_value>",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "      default_route_table_id: <computed_value>",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                {
                "level": "INFO",
                "message": "      default_security_list_id: <computed_value>",
                "timestamp": "2018-05-24T00:57:14.172000+00:00",
                "type": "TERRAFORM_CONSOLE"
                },
                ...
              
To update an execution plan (update an uploaded configuration for a stack)
Note

These instructions don't apply to configurations stored in source code control systems. You can store your Terraform configuration file locally or remotely, using a source code control system. With remote storage, any job running on the associated stack automatically uses the latest version of your configuration. For more information about remotely storing your file, see Managing Configuration Source Providers (Console).

To edit a configuration file that was generated from a sample solution, first download the configuration. Then use the edited configuration file for the update.

Open a command prompt and run oci resource-manager stack update with the option --config-source to update the Terraform configuration for the specified stack: 

oci resource-manager stack update --stack-id <stack_OCID> --config-source <config_file_name>

After updating the stack, regenerate and review an execution plan (run a new plan job and then view the log file).

To run an apply job

To check the current state of the apply job

Open a command prompt and run oci resource-manager job create-apply-job with the relevant value for --execution-plan-strategy (examples use --display-name, which is optional): 

  • To specify a plan job ("apply" an execution plan), use FROM_PLAN_JOB_ID:

    oci resource-manager job create-apply-job --stack-id <stack_OCID> --execution-plan-strategy FROM_PLAN_JOB_ID --execution-plan-job-id <plan_job_OCID> --display-name "Example Apply Job"

    Use this option to "apply" your confirmed execution plan to the stack, execute the instructions, and provision the stack with the specified resources.

  • To automatically approve the apply job (no plan job specified), use AUTO_APPROVED:

    oci resource-manager job create-apply-job --stack-id <stack_OCID> --execution-plan-strategy AUTO_APPROVED --display-name "Example Apply Job"

Depending on the complexity of your execution plan, the operation can take some time. Periodically check the lifecycle state of your apply job to see when it switches from IN_PROGRESS to SUCCEEDED.

To check the current state of the apply job

Open a command prompt and run oci resource-manager job get to retrieve information about the job: 

oci resource-manager job get –-job-id <apply_job_OCID>
Lifecycle states
Possible values for lifecycle-state:
  • ACCEPTED: The job is queued for execution.
  • IN_PROGRESS: The job is running.
  • FAILED: The job has failed and stopped running.
  • SUCCEEDED: The job has completed successfully.
  • CANCELING: The job has been notified to cancel, but has not yet stopped running.
  • CANCELED: The job was canceled and has stopped running.

To confirm existence of newly provisioned resources, inspect resources in the compartment.

To download or view job information

You can download Terraform configurations and Terraform states associated with jobs. You can also view logs associated with jobs.

For configurations stored in a source code control system, such as GitLab, job details include the relevant commit identifier.

To download the configuration for a job

Open a command prompt and run oci resource-manager job get-job-tf-config to download the Terraform configuration of the specified job to the specified file:

oci resource-manager job get-job-tf-config –job-id <job_OCID> --file <output_file_name>
To download the state file for a job

Open a command prompt and run oci resource-manager job get-job-tf-state to download the Terraform state of the specified job to the specified file: 

oci resource-manager job get-job-tf-state --job-id <job_OCID> --file <output_file_name>
Example response for an apply job
{
                "data": {
                "lineage": "57ef4f0c-c8cd-8a32-d45f-d2c40be7b915",
                "modules": [
                {
                "depends_on": [],
                "outputs": {},
                "path": [
                "root"
                ],
                "resources": {
                "oci_core_virtual_network.vcn1": {
                "depends_on": [],
                "deposed": [],
                "primary": {
                "attributes": {
                "cidr_block": "10.0.0.0/16",
                "compartment_id": "ocid1.tenancy.oc1..uniqueid",
                "default_dhcp_options_id": "ocid1.dhcpoptions.oc1.phx.uniqueid",
                "default_route_table_id": "ocid1.routetable.oc1.phx.uniqueid",
                "default_security_list_id": "ocid1.securitylist.oc1.phx.uniqueid",
                "display_name": "My VCN display name",
                "dns_label": "myvcntest",
                "id": "ocid1.vcn.oc1.phx.uniqueid",
                "state": "AVAILABLE",
                "time_created": "2018-05-24 01:13:05.855 +0000 UTC",
                "vcn_domain_name": "myvcntest.oraclevcn.com"
                },
                "id": "ocid1.vcn.oc1.phx.uniqueid",
                "meta": {
                "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": {
                "create": 300000000000,
                "delete": 300000000000,
                "update": 300000000000
                }
                },
                "tainted": false
                },
                "provider": "provider.oci",
                "type": "oci_core_virtual_network"
                }
                }
                }
                ],
                "serial": 4,
                "terraform_version": "0.11.7",
                "version": 3
                }
                }
To view the log for a job

View the log file and note the "message" fields in the sequence of log entries of the log file. You can view the log file for the specified job as either a paged list of entries or in its raw form.

To view the log as a paged list of entries, open a command prompt and run oci resource-manager job get-job-logs:

oci resource-manager job get-job-logs --job-id <job_OCID>

To view the log in raw form, open a command prompt and run oci resource-manager job get-job-logs-content:

oci resource-manager job get-job-logs-content --job-id <job_OCID>
To import an existing Terraform state file (run an import job)

Open a command prompt and run oci resource-manager x to import an existing state file for resources already managed by Terraform: 

oci resource-manager job create-import-tf-state-job --stack-id stack_id --tf-state-file state_file
To inspect resources in a compartment

Inspecting resources in a compartment allows you to confirm existence of a resource that you provisioned (by running an apply job) or absence of a resource that you released (by running a destroy job).

Open a command prompt and run the CLI command corresponding to the resources you want to inspect.

For example, run oci network vcn list to inspect VCN resources in the specified compartment:

oci network vcn list --compartment-id <compartment_OCID>
To release a stack’s resources (run a destroy job)
Note

We recommend running a destroy job before deleting a stack to release associated resources first. When you delete a stack, its associated state file is also deleted; therefore, you lose track of the state of its associated resources. Cleaning up resources associated with a deleted stack can be difficult without the state file, especially when those resources are spread across multiple compartments. To avoid difficult cleanup later, we recommend that you release associated resources first by running a destroy job.

Open a command prompt and run oci resource-manager job create-destroy-job to tear down and clean up the resources provisioned by the specified stack: 

oci resource-manager job create-destroy-job --stack-id <stack_OCID> --execution-plan-strategy=AUTO_APPROVED

To confirm deletion of the resources, inspect resources in the compartment.

Managing Configuration Source Providers (CLI)

Use configuration source providers to store Terraform configuration files in source code control systems. You can then reference those stored files when you create stacks. Supported options:

  • GitLab: Supports the following products: 
    • GitLab Community Edition
    • GitLab Enterprise Edition
    • GitLab.com
To create a configuration source provider
Important

To connect to GitLab, you must use a Personal Access Token. See Prerequisites for connecting to GitLab.

Open a command prompt and run resource-manager configuration-source-provider create-gitlab-access-token-provider to create a configuration source provider: 

oci resource-manager stack create-gitlab-access-token-provider --api-endpoint <gitlab_url> --access-token <personal_access_token> --compartment-id <compartment_OCID> --display-name "<friendly_name>" --description "<description>"

For a complete list of flags and options available for CLI commands, see CLI Help.

For example: 

oci resource-manager stack create-gitlab-access-token-provider --api-endpoint https://gitlab.com/api/v3/ --access-token token --compartment-id ocid1.tenancy.oc1..uniqueid --display-name "My Configuration Source Provider" --description "Department 80"
To update a configuration source provider

Open a command prompt and run resource-manager configuration-source-provider update-gitlab-access-token-provider to edit the specified configuration source provider: 

oci resource-manager stack update-gitlab-access-token-provider --config-source-configuration-source-provider-id <configuration_source_provider_OCID> --api-endpoint <gitlab_url> --access-token <personal_access_token> --display-name "<friendly_name>" --description "<description>"

For a complete list of flags and options available for CLI commands, see CLI Help.

For example: 

oci resource-manager stack update-gitlab-access-token-provider --config-source-configuration-source-provider-id ocid.ormconfigsourceprovider.oc1..uniqueid --description "Department 99"
To delete a configuration source provider
Note

A configuration source provider cannot be deleted if it is associated with a stack. To remove the association from the stack, edit the stack.

Open a command prompt and run resource-manager configuration-source-provider delete to delete the specified configuration source provider: 

oci resource-manager configuration-source-provider delete --config-source-configuration-source-provider-id <configuration_source_provider_OCID>

For a complete list of flags and options available for CLI commands, see CLI Help.

Using the API