Create a Virtual Cloud Network

Use Terraform to create a virtual cloud network (VCN) in your Oracle Cloud Infrastructure tenancy.

Key tasks include how to:

  • Set up a basic VCN.
  • Define and add the following resources to the network:
    • Security lists
    • Private and public subnets
A diagram of the components needed to create an Oracle Cloud Infrastructure virtual cloud network with Terraform. From a local Linux environment, the user creates a virtual cloud network with Terraform. This network has a public subnet that can be reached from the internet. The network also has a private subnet that connects to the internet through a NAT gateway, and also privately connects to the Oracle Services Network. The CIDR block for the virtual cloud network is 10.0.0.0/16, for the public subnet is 10.0.0.0/24, and for the private subnet is 10.0.1.0/24.

For more information, see:

Before You Begin

1. Prepare

Prepare your environment for creating a VCN. Also, collect all the information you need to complete the tutorial.

2. Create a Basic Network

Create scripts for authentication, a basic virtual cloud network (VCN) defined by a module, and outputs.

3. Customize the Network

Create scripts for security lists, private subnets, and public subnets to create the same virtual network as in the Console creation workflow.

4. Re-create the VCN (Optional)

Destroy your VCN. Then rerun your scripts to create another VCN.