Introduction to Infrastructure as Code with Terraform
What is Infrastructure as Code and Why is Terraform Useful?
Install Terraform on Mac, Linux, or Windows by downloading the binary or using a package manager (Homebrew or Chocolatey). Then create a Docker container locally by following a quick-start tutorial to check that Terraform installed correctly.
Authenticate to Oracle Cloud Infrastructure, and create a Virtual Cloud Network. Write, format and validate a Terraform configuration. Plan and apply the configuration to create an VCN OCI resource.
Add a subnet to your Oracle Cloud Infrastructure (OCI) VCN. Modify the subnet display name and plan changes to update the resource in place. Learn how Terraform handles infrastructure change management.
Destroy the Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN) and subnet you created in the previous tutorials. Evaluate the plan and confirm the destruction.
Define Input Variables
Declare your OCI region and compartment ID as variables. Reference the variable in Terraform configuration. Define variables using .tfvars files or default values.
Query Data with Outputs
Declare output values to display the status and CIDR block of your OCI VCN. Display all outputs and query specific outputs. Define what data stored in Terraform state is relevant to the operator or end user.