How to automate OCI with Terraform

Lesson 1 – VCN, Subnet and Single Webserver

In this lesson you will create the simplest set of OCI resources, starting with one compartment, one VCN, and one subnet in this VCN. The subnet will be regional (covering all availability domains AD1-AD3). Inside this public subnet, we will nest one VM for Webserver. Public subnet means that VM will have public IP associated – VM will be exposed to the public Internet (via Internet Gateway and proper route table). After this deployment, one basic Security List will permit access from the public Internet to VM via protocol SSH (port 22) & HTTP/HTTPS protocols (port 80, 443). For the software provisioning, we will utilize null_resource and remote-exec capability of Terraform Null Provider – Terraform will install the HTTP server with root webpage content. As a consequence, after successful terraform apply, we should be able to visit VM public IP address with our web browser and expect their simple webpage content – Welcome to FoggyKitchen.com! This is WEBSERVER1…

 

Here is GitHub repo where you can download the code for this lesson.

One thought on “Lesson 1 – VCN, Subnet and Single Webserver

Leave a Reply