oci_core_vcn

This resource provides the Vcn resource in Oracle Cloud Infrastructure Core service.

The VCN automatically comes with a default route table, default security list, and default set of DHCP options. For managing these resources, see Managing Default VCN Resources

Creates a new Virtual Cloud Network (VCN). For more information, see VCNs and Subnets.

For the VCN, you specify a list of one or more IPv4 CIDR blocks that meet the following criteria:

For a CIDR block, Oracle recommends that you use one of the private IP address ranges specified in RFC 1918 (10.0.0.0/8, 172.1612, and 192.16816). Example: 172.16.0.0/16. The CIDR blocks can range from /16 to /30.

For the purposes of access control, you must provide the OCID of the compartment where you want the VCN to reside. Consult an Oracle Cloud Infrastructure administrator in your organization if you’re not sure which compartment to use. Notice that the VCN doesn’t have to be in the same compartment as the subnets or other Networking Service components. For more information about compartments and access control, see Overview of the IAM Service. For information about OCIDs, see Resource Identifiers.

You may optionally specify a display name for the VCN, otherwise a default is provided. It does not have to be unique, and you can change it. Avoid entering confidential information.

You can also add a DNS label for the VCN, which is required if you want the instances to use the Interent and VCN Resolver option for DNS in the VCN. For more information, see DNS in Your Virtual Cloud Network.

The VCN automatically comes with a default route table, default security list, and default set of DHCP options. The OCID for each is returned in the response. You can’t delete these default objects, but you can change their contents (that is, change the route rules, security list rules, and so on).

The VCN and subnets you create are not accessible until you attach an internet gateway or set up a Site-to-Site VPN or FastConnect. For more information, see Overview of the Networking Service.

Supported Aliases

Example Usage

resource "oci_core_vcn" "test_vcn" {
	#Required
	compartment_id = var.compartment_id

	#Optional
	byoipv6cidr_details {
		#Required
		byoipv6range_id = oci_core_byoipv6range.test_byoipv6range.id
		ipv6cidr_block = var.vcn_byoipv6cidr_details_ipv6cidr_block
	}
	cidr_block = var.vcn_cidr_block
	cidr_blocks = var.vcn_cidr_blocks
	defined_tags = {"Operations.CostCenter"= "42"}
	display_name = var.vcn_display_name
	dns_label = var.vcn_dns_label
	freeform_tags = {"Department"= "Finance"}
	ipv6private_cidr_blocks = var.vcn_ipv6private_cidr_blocks
	is_ipv6enabled = var.vcn_is_ipv6enabled
	is_oracle_gua_allocation_enabled = var.vcn_is_oracle_gua_allocation_enabled
	security_attributes = var.vcn_security_attributes
}

Argument Reference

The following arguments are supported:

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain operations: * create - (Defaults to 20 minutes), when creating the Vcn * update - (Defaults to 20 minutes), when updating the Vcn * delete - (Defaults to 20 minutes), when destroying the Vcn

Import

Vcns can be imported using the id, e.g.

$ terraform import oci_core_vcn.test_vcn "id"