Created
May 26, 2024 00:21
-
-
Save DavideDunne/d241009151cd1e1e2836c99c21d56f01 to your computer and use it in GitHub Desktop.
Terraform for creating an OCI VCN with a subnet and an internet gateway
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_vcn | |
resource "oci_core_vcn" "test_vcn" { | |
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
# cidr block: Collection of IP's | |
# Will be assigning 255 addresses | |
cidr_block = "192.168.1.0/24" | |
display_name = "tec vcn" | |
dns_label = "tecvcn" | |
} | |
# https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_subnet | |
resource "oci_core_subnet" "test_subnet" { | |
cidr_block = "192.168.1.0/24" | |
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
vcn_id = oci_core_vcn.test_vcn.id | |
display_name = "tec subnet" | |
dns_label = "itc" | |
prohibit_internet_ingress = "false" | |
prohibit_public_ip_on_vnic = "false" | |
} | |
# https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_internet_gateway | |
resource "oci_core_internet_gateway" "test_internet_gateway" { | |
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
vcn_id = oci_core_vcn.test_vcn.id | |
enabled = "true" | |
display_name = "Internet Gateway" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment