X

Break New Ground

Using Resource Manager solution templates

Prasenjit Sarkar
Senior Principal Product Manager

 

Resource Manager is an Oracle Cloud Infrastructure (OCI) service that lets you automate the process of provisioning your OCI resources. Using Terraform, Resource Manager helps you install, configure, and manage resources through the infrastructure-as-code (IaC) model.

A Terraform configuration codifies your infrastructure in declarative configuration files. Resource Manager lets you share and manage infrastructure configuration and state files across multiple teams and platforms. This infrastructure management can’t be done with local Terraform installations and Oracle Terraform modules alone.

 

Key concepts

Following are brief descriptions of key concepts and the main components of Resource Manager. For more information, see the service documentation.

  • Configuration: Information that codifies your infrastructure. A Terraform configuration can be a solution or a file that you write. You can upload your written file directly or store it in a source code control system.

  • Configuration source provider: Connection information to a source code control system in which your Terraform configuration files are stored. Use a configuration source provider to create a stack from a remote, versioned Terraform configuration file.

  • Drift: The difference between the actual 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.

  • Job: Instructions to perform the actions defined in your configuration. Only one job at a time can run on a given stack, and you can have only one set of OCI resources on a given stack. Resource Manager provides the following job types: plan, apply, destroy, and import state.

  • Module: A group of related resources. Use modules to create lightweight and reusable abstractions so that you can describe your infrastructure in terms of its architecture.

  • Package: A zip file to a Terraform configuration that is stored in a supported provider, such as GitHub.

  • Resource discovery: A feature that captures deployed resources as Terraform configuration and state files. With this feature, you can move from manually managed infrastructure to Resource Manager-controlled infrastructure, learn how Terraform uses HashiCorp Configuration Language (HCL) syntax to represent OCI resources, and duplicate or rebuild existing infrastructure in another compartment.

  • Sample solution: An Oracle-provided, prebuilt Terraform configuration that provisions a set of resources used in a common scenario.

  • Stack: The collection of OCI resources corresponding to a given Terraform configuration. Each stack resides in the compartment that you specify, in a single region; however, resources on a given stack can be deployed across multiple regions. An OCID is assigned to each stack. You can create stacks from solutions, from remote or local Terraform configurations, or from existing compartments by using resource discovery.

 

Install the Oracle Cloud Development Kit using Resource Manager

The Oracle Cloud Development Kit preinstalls the following OCI items on a compute instance:

  • Command line interface (CLI)
  • Terraform provider
  • Ansible (includes OCI Ansible modules)
  • Go, Java, and Python SDKs
  • Git

Instance principal authorization is set up for installed items and the provisioned compute instance. An upgrade script is also included.

To provision an instance with the development kit, follow these steps:

  1. Sign in to Oracle Cloud Console.
  2. In the navigation menu, go to Resource Manager and then 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 Create Stack.
  5. On the Stack Information page, select Sample Solution.
  6. In the Stack Configuration box, click Select Solution.
  7. On the Architecture tab, select Oracle Cloud Development Kit.
  8. Enter a name for the stack or accept the default name provided.


    Figure 1: Resource Manager stack for Oracle Cloud Development Kit
     
  9. Optionally, enter a description.
  10. From the Create in Compartment list, select the compartment in which to create the stack.
  11. Click Next.
  12. On Configure Variables page, provide values for the following variables:
  • Instance Shape: Select the shape to use for the compute > instance.

  • Auto-Generate SSH Key Pair: To automatically generate an SSH key > pair for accessing the instance, select this option. The private > key is stored in the Terraform state file. To upload a public key > instead, don’t select the option. No private key is stored, so > keep the corresponding private key in a safe location. You use the > private key later to connect to the instance.

  • Compute Instance to Access All Resources at Tenancy Level: > Controls the level used for the dynamic group policy, which > determines what resources users of the compute instance can > access. Select this option to give users access to all the > resources in the tenancy. If you don’t select this option, users > have access only to the resources in the same compartment as the > instance.


    Figure 2: Choosing a shape and other variables

  1. Click Next.
  2. On the Review page, verify your stack configuration, and then click Create.

The new stack appears in the Stack Details page.

  1. On the Stack Details page for the stack, click Terraform Actions and select Apply.


    Figure 3: Running a Terraform job to create an instance
     
  2. Review the name of the apply job and the other settings, and update them if needed.
  3. Click Apply.

 

Connect to the new instance

After the stack is created, retrieve the instance’s private key to connect to the instance and perform any actions.

  1. Go to the Job Details page for your new instance: In the navigation menu, go to Resource Manager, click Stacks, click the name of the stack, and then click the name of the apply job that you ran to create the instance.
  2. Click the Application Information tab.


    Figure 4: Resource Manager solution details
     
  3. Copy the value for Compute Instance Public IP.
  4. Get the private key by following the step that corresponds to the key option you selected when creating the stack:
    • If you selected Auto-Generate SSH Key Pair, retrieve the generated private key by copying the value for Generated Private Key for SSH Access.
    • If you didn’t select Auto-Generate SSH Key Pair, reference the full path and name of the file that contains the private key that corresponds to the public key that you uploaded when creating the stack.

Note: When you connect to the instance, the private key file permissions are validated. For security, your private key must be accessible by the owner only; otherwise, you can’t connect to the instance. (Owner write permissions are required for you to add the private key to the file.) For UNIX or Linux, use the command chmod`` 600 (-``rw``-------).

After you connect to the instance, you can use the installed development kit.

That’s how quickly you can provision an OCI development environment and get started with your OCI development tasks.

 

Conclusion

This post provided an overview of the Oracle Cloud Infrastructure Resource Manager and showed how to create a sample solution that helps you to create a development environment within Oracle Cloud Infrastructure itself by using Resource Manager.

 

Resources

 

Oracle Cloud Infrastructure provides Enterprise features for developers to build modern cloud applications. Try the Oracle Cloud Free Tier with 300$ credits for a 30 Day Free Trial. Free Tier also includes a number of “Always Free” services that are available for an unlimited period of time even after your free credits expire.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.