Create a Virtual Cloud Network in Oracle Cloud
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Karthic Kumaran 8d16971e6a
Update README.md
8 months ago
bin update decrypt.sh 1 year ago
resources add screenshots 8 months ago
.gitignore add encrypted terraform state files 1 year ago
.terraform.lock.hcl add terraform lock 8 months ago
LICENSE Initial commit 1 year ago
README.md Update README.md 8 months ago
india.tfvars.gpg comments for terraform 1 year ago
india.tfvars.sample format 1 year ago
main.tf comments for terraform 1 year ago
terraform.tfstate.backup.gpg comments for terraform 1 year ago
terraform.tfstate.gpg comments for terraform 1 year ago

README.md

Terraform — Create a Virtual Cloud Network in Oracle Cloud

Create a Virtual Cloud Network (VCN) in Oracle Cloud.

You can run two servers for free by using the Oracle Cloud Always Free tier. Deploy an instance using either of the Terraform scripts below,

Code Mirrors

Configuration

Step 1: Create a file to store the Terraform input variables. Use india.tfvars.sample as a reference. Keep india.tfvars as the filename or change the name in the following files,

  1. .gitignore
  2. bin/plan.sh

Step 3: Set vcn_cidr, public1_cidr and private1_cidr as desired.

Step 3: Set compartment to the desired value. List of compartments in your Oracle Cloud account are at cloud.oracle.com/identity/compartments.

compartment list screenshot

Authentication

Oracle provider documentation is at registry.terraform.io/providers/hashicorp/oci/latest.

Oracle Cloud Shell can deploy this script without configuration.

Deployment

Step 1: Use the following command to create a Terraform plan,

$ ./bin/plan.sh

To avoid fetching the latest state of resources, use the following command,

$ ./bin/plan.sh -refresh=false

Step 2: Review the plan using the following command,

$ ./bin/view.sh

Step 3: Apply the plan using the following command,

$ ./bin/apply.sh

Step 4: Use the following command to display the public subnet,

$ terraform show oci_core_subnet.public

terraform public subnet

Step 5: Use the following command to display the private subnet,

$ terraform show oci_core_subnet.private

terraform private subnet

Encryption

Encrypt sensitive files (Terraform input variables and state) before saving them. .gitignore must contain the unencrypted file paths.

Use the following command to decrypt the files after cloning the repository,

$ ./bin/decrypt.sh

Use the following command after running bin/apply.sh to encrypt the updated state files,

$ ./bin/encrypt.sh <gpg key id>