Oracle Cloud Infrastructure Documentation

Using Resource Manager in the Console

You can use the Oracle Resource Manager on the command line using the CLI or by using the Oracle Cloud Infrastructure Console. This topic walks through completing Resource Manager tasks using the Console. For more information on the CLI workflow, see Using Resource Manager with the CLI.

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.

For more information on getting started using the Oracle Cloud Infrastructure Console, see Signing In to the Console and Using the Console.

For a high-level summary of the Resource Manager, see Overview of Resource Manager.

About Terraform Configurations

These guidelines for using the Console with Resource Manager assume that you are using a Terraform configuration.

Configurations set variables and describe your infrastructure in declarative code. The configuration files are bundled into a .zip file then uploaded to Resource Manager.

A Terraform configuration is a set of files that:

  • Defines the Terraform provider
  • Specifies which resources are provisioned
  • Defines variables
  • Provides specific instructions for the apply job to follow when provisioning resources in the stack

For more information about configurations, see Terraform Configuration and Writing Terraform Configurations.

Resource Manager supports the native Terraform behavior for handling variables. You can include a terraform.tfvars file and files with the .auto.tfvars extension in the configuration .zip file. For more information about defining variables, see Define Variables and Input Variables.

Note

Resource Manager requires the following structure for the configuration:

  • Configuration .zip files should not contain Terraform state files.
  • You should not set the API private key in the configuration.

  • Resource Manager will return an error if the .zip file is empty, contains no .tf files in the working directory, contains a .terraform directory, or is corrupted.

Writing the configuration is the most important part of using Resource Manager to provision your Oracle Cloud Infrastructure tenancy. After you create a configuration, you can version, persist, and share that configuration.

Declaring the Terraform Provider

When using Resource Manager, the region field in the provider "oci" block is the only required field. All other fields, such as userid or fingerprint, are optional.

Example

The following example shows a configuration that is contained in a single file. This very basic sample defines just one Terraform provider, one Oracle Cloud Infrastructure resource, and declares a set of variables.



variable "compartment_ocid" {}
variable "region" {}

provider "oci" {
  region = "${var.region}"
}

resource "oci_core_virtual_network" "vcn1" {
  cidr_block = "10.0.0.0/16"
  dns_label = "vcn1"
  compartment_id = "${var.compartment_ocid}"
  display_name = "vcn1"
}

More often, Terraform configurations consist of two or more files bundled together and uploaded in a .zip file. To see more complex, multi-file examples of Terraform configurations, explore the examples at the Oracle Cloud Infrastructure GitHub: terraform-provider-oci/docs/examples.

Access the Resource Manager

After you sign in to the Console, you can access the Resource Manager by opening the navigation menu in the upper left corner of the Console. Select Resource Manager, then select Stacks or Jobs. Resource Manager defaults to Stacks.

In addition to the navigation menu, there are also the following icons and menus at the top of the Console:

  • Search box
  • Region selection drop-down for selecting your region
  • Question-mark icon for accessing Console documentation and support
  • User icon for accessing user settings and tenancy information

Click the user icon. From the user information drop-down, select Tenancy. The page displays important information and provides access to tenancy settings:

Note

The tenancy OCID is on the Tenancy Details page. Open the User menu and click Tenancy: <your_tenancy_name>. The tenancy OCID is shown under Tenancy Information.

Compartments

On the left of the Console, below the List Scope label, a drop-down labeled Compartment allows you to select a compartment. The list of compartments is filtered to display only those compartments that you have access to. If a compartment that you expect to see is not listed, contact your administrator.

Compartments allow you to organize your resources and control access to compartments and the resources they contain. Each tenancy is created with a default "root" compartment. The tenancy administrator can then create additional compartments, then restrict access to each compartment and its resources using role-based access control (RBAC) provided by Identity and Access Management (IAM).

For more information about compartments, see Managing Compartments. For more information about access control, see Overview of Oracle Cloud Infrastructure Identity and Access Management.

Managing Stacks

Use stacks to organize groups of Oracle Cloud Infrastructure resources that you can then use jobs to act on as a group. Stacks and the resources they contain are scoped to compartments, so you can only act on stacks that reside in the selected compartment.

Important

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

Click Stacks to show a table of all of the stacks in the compartment. The table lists the stack name, an optional description, the current state of the stack, and the stack's create date and time. To act on a specific stack, click the stack name to open that stack's action page.

You can click the action icon (three dots) at the right side of the job row to do the following:

  • View Stack Details displays Stack Information and the Jobs table
  • Edit opens a dialog to edit name, description, and variables for the stack
  • Copy OCID copies the stack's OCID to clipboard
  • Delete deletes the stack

You can perform several actions from the stack's action page:

Create a Stack
Edit or Delete a Stack
Update a Stack
Move a Stack to a Different Compartment
Edit Variables

Managing Jobs

On the Stack Details page, the Terraform Actions drop-down provides four options: Plan Job, Apply Job, Import State, and Destroy Job. These are the four job types that you can perform on a stack.

  • Plan Job. Terraform parses your configuration files and creates an execution plan that lists the actions taken and the resources that are created on the stack once the plan job is applied. We recommend creating a plan job before running an apply job.
  • Apply Job. Terraform applies your configuration to the associated stack, creates the stack resources defined in this configuration, and then executes the actions that are defined in the configuration. The time required to complete an apply job depends on the number and type of cloud resources to be created.
  • Import State. If you already have existing Terraform-managed resources, you can import an existing Terraform state file.
  • Destroy Job. Run a destroy job to tear down the resources and clean up the tenancy. You can monitor the status and review the results of a destroy job by inspecting the stack's state file, or by reviewing log files.

The Jobs table lists the job name, type, state, stack, start time and end time. You can click the action icon (three dots) at the right side of the job row to do the following:

  • Download Logs allows you to download log files for the job that you've run on the stack.
  • Download Terraform State allows you to download the job's state (.json) file.
  • Download Execution Plan allows you to download the execution plan generated by the plan job (see following). The execution plan is a binary file and cannot be accessed directly. Instead, view job's log files to evaluate execution of the job.

From the Job Details page you can perform several actions:

View Job Details
Download Terraform State File, Terraform Configuration (snapshot) and Job Logs
Run a Plan Job
Run an Apply Job
Import State
Run a Destroy Job

Adding Tags to Stacks, Jobs, and Tenancies

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.

Tags are key/value pairs that you can attach to resources to help you organize and track your tenancy resources. This is helpful when managing large numbers of resources across several compartments. You can apply tags to two Resource Manager resource types: stacks and jobs. You can also apply tags to the Oracle Cloud Infrastructure tenancy resource type.

Adding Tags to a Stack
Adding Tags to a Job
Adding Tags to a Tenancy