Running templates from CLI
You can run templates from CLI, similar to running the Terraform templates from OCI Resource Manager.
To run the templates from CLI:
- Download Terraform from the following URL and install Terraform.
- Download the Terraform stack builder file.
Note:
The VCN and SBC folder is a part of the Terraform stack builder tar file (For example - SCZ910_tfStackBuilder.tar.gz). - Extract the Terraform stack builder file.
tar -xzvf <filename>_tfStackBuilder.tar.gz
- Change directory to point to the SBC folder.
cd oci/SBC
Note:
If you are creating a VCN, change directory to VCN folder. - Uncomment these lines in the provider.tf file.
user_ocid = var.user_ocid fingerprint = var.fingerprint private_key_path = var.oci_api_private_key_path
- Save the file.
- Export the required environment variables. For example:
export TF_VAR_region="us-phoenix-1" export TF_VAR_tenancy_ocid="ocid1.tenancy.oc1..aaaaaaauhdcynzumstqiwxbx5d2mkmeqflyfnwsta6gn4g7ofmnfkq" export TF_VAR_compartment_ocid="ocid1.compartment.oc1..aaaaaaaa6pylpay5csm5xw2e5tzine24vtvqpguepm7g45r4rrr7cla" export TF_VAR_oci_api_private_key_path="$HOME/.oci/oci_api_key.pem" export TF_VAR_user_ocid="ocid1.user.oc1..aaaaaa7f76hacxruga2hjsgp2vqsypx7ejaqrbv54vgxhymnq" export TF_VAR_fingerprint="cb:b6:86:6:6d:9c:8a:88:3b:85:72:f9:47:34:5c:43"
- Edit the terraform.tfvars file and change the configuration variables as required.
- Save the file.
- Edit the entitlements/<product>.yaml file and change the entitlement parameters as required.
- Save the file.
- Run this command to initiate Terraform.
terraform init
- Run this command to verify the templates and new OCI resource that will be created based on the configuration variables.
terraform plan
- Run this command to create the resources.
terraform apply
- Run this command to destroy the resources.
terraform destroy
- Change directory to point to the VCN folder.
cd oci/VCN
Repeat steps 5 through 15 to create a VCN stack.