Oracle OCI | Terraform

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 https://www.youtube.com/watch?v=MjmikFgvKvI&t=3288s

Get Started : https://www.youtube.com/watch?v=GIRjciGRDl4&t=19s  


Installing Terraform on Windows

https://docs.oracle.com/en/solutions/terraform-cloud-infrastructure-ebusiness-suite/ebs-configuring-terraform-windows-systems.html

Oracle Documentation Terraform

https://docs.oracle.com/en-us/iaas/developer-tutorials/tutorials/tf-provider/01-summary.htm


Install Git Bash

https://www.youtube.com/watch?v=qdwWe9COT9k


https://git-scm.com/downloads


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to work with Terraform

https://www.youtube.com/watch?v=GIRjciGRDl4&t=19s

1. First we need to download Terraform - Go to the terraform website and download terraform. After downloading you need to move to a path directory 



/usr/local/bin -- is a common path directory file , but you can choose any directory as you wish . Once you have move your terraform to your path directory . You are now ready to write your terraform code. 

2. Make sure you have your favorite script editor installed. I high recommend using Visual Code Editor . Since it has terraform script extensions 

3. Lets open up our terminal and lets see if terraform is installed . terraform --version 

4. Now Open up your internet browser and go to github 





https://github.com/oracle/terraform-provider-oci/tree/master/examples

In this demo we will be using terraform to create a Linux Compute instance , Volume & an Object Storage Bucket in our OCI tenancy

Here you can find all of the terraform code required to create a compute instance .

examples > compute > instance

https://github.com/oracle/terraform-provider-oci/tree/master/examples/compute/instance

Next provider data

compute.tf


Before we can run Terraform on OCI we need to generate a API finger print

Click add public key , here you need to paste your public key.


If you successfully enter your public key .

You will have to copy and paste it into your terraform code to gain access to the OCI Tenancy.

Now we need to setup our environment file which is inside our terraform folder that we created earlier

here is the environment file that we need to open .


https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm

next open your terraform file 



check this link , go to instance > change image source > read release notes > select the OS version click > on read more > OCI Image id


1. enter the source command to instantiate  source file .

$ source env-vars.sh

$ terraform init



















 


 If we go to the cloud shell , I have the ssh-key created there .

cd .ssh

you will find the RSA file that is what is added to the variables files above there. 

Variable.tf   file


Variable.tf   file

 

they are getting the information from terrform.tfvars file,








 

 

 

Comments

Popular posts from this blog

Terraform : AWS : Terraform on AWS with SRE & IaC DevOps | Section 2 : Terraform basics

Terraform : AWS : Terraform on AWS | Section 4: Terraform Input Variables and Datasources

Terraform VPC - on AWS : Three tier architecture design