Terraform을 위한 Oracle 설정하기 - Compartment 정의하기

Tim·2023년 10월 10일

Hold Tight Terraform

목록 보기
5/5

오라클 클라우드는 Tenancy안에 Compartment가 있고
해당 Compartment내에 리소스를 배포한다.
테라폼 레지스트리 compartment resource 를 보면

필수 항목은 아래 세가지이다.

  • compartment_id - (Required) (Updatable)
    - The OCID of the parent compartment containing the compartment.
  • description - (Required) (Updatable)
    - The description you assign to the compartment during creation. Does not have to be unique, and it's changeable.
  • name - (Required) (Updatable)
    - The name you assign to the compartment during creation. The name must be unique across all compartments in the parent compartment. Avoid entering confidential information.
# compartment.tf

resource "oci_identity_compartment" "tf-compartment" {
    compartment_id ="<my-root-compartment-ocid>"
    description="Oracle Compartment defined by Terraform for practice"
    name="hold-tight-terraform"
}

output "compartment-name"{
    value = oci_identity_compartment.tf-compartment.name
}

output "compartment-ocid"{
    value = oci_identity_compartment.tf-compartment.id
}

terraform plan
terraform apply
해주면


올바르게 잘 생성된걸 콘솔에서 확인할 수 있다.

profile
A man without a goal is like a ship without a rudder - Thomas Carlyle

0개의 댓글