-
Introduction
-
Basic Topologies
- Lesson 1 – VCN, Subnet and Single Webserver
- Lesson 2 – Second Webserver in other Availability Domain (AD)
- Lesson 2a – Second Webserver in other Fault Domain (FD)
- Lesson 3 – Load Balancer
- Lesson 4 – Load Balancer + NAT Gateway + Bastion Host
- Lesson 4a – Load Balancer + NAT Gateway + Bastion Host (+ Network Security Groups)
- Lesson 5 – Shared Filesystem
- Lesson 5a – Shared Filesystem (+ Network Security Groups)
- Lesson 6 – Local Block Volume
- Lesson 7 – DBSystem
- Lesson 7a – DBSystem with DataGuard
-
Advanced Topologies
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.
What if I want to create the VM inside an already created compartment?
It will require some small changes in the code. You should remove compartment.tf file and in each other tf file you should change the value of compartment_id the attribute (for example compartment_id = var.compartment_ocid). In that case each and every resource will be created in the compartment value populated within TF_VAR_compartment_id system environment (it can be tenant OCID for root compartment or any other compartment below the root compartment).
Hi Luke … I have a question why this command doesn’t work on the subnet (security_list_ids = oci_core_security_list.sglist_tf.id) without brackets … like others resources like a compartment_id …
Using brackets is related to plural form (security_list_ids not security_list_id), so you need to cast the collection type. Check this link with TF docs: https://www.terraform.io/docs/configuration/types.html
Super quick course which completely packed with lot of great information. Great 🙂