Build, change, and destroy a virtual cloud network and subnet on Oracle Cloud Infrastructure (OCI) using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
Learn how infrastructure as code lets you safely build, change, and manage infrastructure. Try Terraform.
9min
Install Terraform
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.
12min
Build Infrastructure - Terraform OCI Example
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.
6min
Change Infrastructure
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.
5min
Destroy Infrastructure
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.
6min
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.
6min
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.