Instructions to get your environment ready to deploy ISV solutions
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
images better pic Aug 29, 2018
LICENSE apache Sep 17, 2018 lost the compartment battle Oct 19, 2018 lost the compartment battle Oct 19, 2018


This README describes the steps to setup your environment so it can run Terraform modules on OCI.

Create an OCI Account

If you don't have an OCI account, you can sign up for a free trial here. The free trial only has the Ashburn region enabled by default. Depending on what Terraform modules you're going to deploy, you may need to enable other regions. Similarly, the default quotas are pretty low, so you might need to request increases.

Install Terraform

Now, we need to install Terraform. Instructions on that are here. Of course, I'm on a Mac, and like to do things the easy way, so I installed brew and then used it to install Terraform with the commands:

/usr/bin/ruby -e "$(curl -fsSL"
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib
brew install terraform

You can test that the install was successful by running the command:


You should see something like:

In the past you needed to manually install the OCI Terraform Provider. However, OCI is now integrated into the Terraform executable, so that's no longer necessary!

Setup Keys

Create an SSH keypair for connecting to VM instances by follow these instructions. You really just need to do this:

ssh-keygen -t rsa -N "" -b 2048 -f ~/.ssh/oci

Now, create a key for OCI API access by following the instructions here. Basically, you need to run these commands:

mkdir ~/.oci
openssl genrsa -out ~/.oci/oci_api_key.pem 2048
openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem
openssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c > ~/.oci/oci_api_key.fingerprint
cat ~/.oci/oci_api_key_public.pem | pbcopy

When complete, open a web browser to the console here. Then select your user, click "Add Public Key" and paste it into the dialog.

Setup Environment Variables

Now, let's take a look at the file.

The script pulls values from the keys you created in the earlier steps. You'll need to update three fields with values you can find in the console:

  • TF_VAR_compartment_ocid
  • TF_VAR_tenancy_ocid
  • TF_VAR_user_ocid

When you've set all the variables, you can source the file with the command source or you could stick the contents of the file in ~/.bash_profile

With that, you're all ready to start running Terraform commands!

Create SSH Config

With the current setup you can SSH to a machine with the command:

ssh -i ~/.ssh/oci <username>@<ip_address>

If we add a ssh_config file, we can simplify that a bit. To create that file, run the command:

echo "Host *
  IdentityFile ~/.ssh/oci
  User opc" > ~/.ssh/config

Now you can SSH to your OEL machines on OCI with the command:

ssh <ip_address>