A simple tutorial to create a bucket in Oracle Cloud using Terraform
1. Set up the OCI Configuration using API Keys
Follow the steps in Setting up the OCI Configuration File using API Keys
2. Install Terraform CLI
On Mac, you can install the CLI using Homebrew: brew install oci-cli
Verify installation using oci -v
in the terminal. For other OSes, see Install Terraform.
3. Write the following Terraform code
terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 7.0.0"
}
}
required_version = ">=1.12"
}
provider "oci" {
region = "us-ashburn-1"
config_file_profile = "DEFAULT"
}
resource "oci_objectstorage_bucket" "test_bucket" {
#Required
compartment_id = "ocid1.tenancy.oc1..aaaaaaaanwazgsy3nui2mz8wttfh26k7ra6xiazgsy3nui2mz8wttfh26k7ra6"
name = "test-bucket"
namespace = "idpugazgsy3"
}
More info about the Terraform resource: oci_objectstorage_bucket
We create the OCI bucket in the root tenancy compartment ID. You may get your tenancy ID and the Object storage namespace under your Tenancy details under Profile once logged into cloud.oracle.com.
4. Apply the terraform plan
Run:
terraform init && terraform apply
Safe harbor statement
The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.
This work is licensed under a Creative Commons Attribution 4.0 International License.
Top comments (0)