Create a Compartment

Use Terraform to connect to your Oracle Cloud Infrastructure account and create a compartment in your tenancy.

Key tasks include how to:

  • Use Oracle Cloud Infrastructure Terraform provider resources to:
    • Declare a compartment with your specifics.
    • Create the compartment in your tenancy.
A diagram of a user connected from a local machine to an Oracle Cloud Infrastructure tenancy. The local environment is Linux and has Terraform installed. There is an arrow from Terraform in the local environment,to Terraform Registry, and to the tenancy, pointing to a compartment. These arrows suggest that the user has created a compartment in the tenancy by using Terraform and Terraform Registry.

For more information, see:

1. Prepare

Prepare your environment for authenticating and running your Terraform scripts. Also, collect all the information you need to complete the tutorial.

2. Create Scripts

Create scripts for authentication, to create a compartment, and to print outputs.

3. Create a Compartment

Run your Terraform scripts. After your account authenticates the scripts, Terraform creates a compartment in your tenancy.