Lab :45 create compartment using modular approach - TanveeKhanDB/OCI GitHub Wiki
Scenario: We have to create one compartment and two sub compartment in OCI with the help of Terracode by using modular approach. A modular Terraform approach is the recommended way to provision resources in Oracle Cloud Infrastructure (OCI) because it makes your code reusable, scalable, and easier to maintain.
Steps to create compartment by terraform code with Modular approch
S1. I have created on tamplate as terra_compartment_tamplate
S2. Providing OCID of our teanancy where going to create compartment.
S3. Terraform plan is working fine
terraform plan
S4. Succesfully creation of parent compartment which is Blinkit:
terraform apply
S5.Creating two child compartment under Blinkit
Blinkit_compute_and_storage
Blinkit_networking
How to distroy any specific services in OCI by Terraform.
terraform destroy -target=module.<module_name>.<Resource_type>.<Resource_Name>
terraform destroy -target=module.parent_compartment.oci_identity_compartment.compartment1