top of page
  • Writer's pictureNikhil Verma

OCI Terraform Deployment

In this blog i am going to deploy Oracle Cloud Infra Virtual Cloud Network and Compute instance using Terraform.

This is very useful for Bulk deployments or uniform environment.

I am using MAC for this , first we need to Prepare Terraform environment. We will use Brew for terraform installation. First we need to install Brew using this command :

/bin/bash -c "$(curl -fsSL"

First, install the HashiCorp tap, a repository of all our Homebrew packages.

brew tap hashicorp/tap

Now, install Terraform with hashicorp/tap/terraform.

brew install hashicorp/tap/terraform

To update to the latest version of Terraform, first update Homebrew.

brew update

Then, run the upgrade command to download and use the latest Terraform version.

brew upgrade hashicorp/tap/terraform

Enable tab completion

touch ~/.zshrc

terraform -install-autocomplete

We are going to deploy below VCN using terraform

Now Terraform installation completed , now we need to prepare terraform files. For VCN deployment we need make sure we should have sufficient access to deploy VCN.

Before preparing variable file we need to should have following things ready :

After declaring all variables we need to initialize them using Terraform.tfvars.

Once we are done with this we need to prepare

  1. First we need to add provider , in my case i am using : oci

  2. then we need to add data source , i have added complete OCI VCN details.

  3. then we need to add resource where i have shared all values.

Please follow all steps here :

Post execution we will see VCN deployed with Internet gateway , Subnet , Route table and security List.

Now we have deployed VCN post this we deploy Compute instance using terraform and OCI Resource Manager.

42 views0 comments
bottom of page