oci_core_internet_gateway

This resource provides the Internet Gateway resource in Oracle Cloud Infrastructure Core service.

Creates a new internet gateway for the specified VCN. For more information, see Access to the Internet.

For the purposes of access control, you must provide the OCID of the compartment where you want the Internet Gateway to reside. Notice that the internet gateway doesn’t have to be in the same compartment as the VCN or other Networking Service components. If you’re not sure which compartment to use, put the Internet Gateway in the same compartment with the VCN. For more information about compartments and access control, see Overview of the IAM Service.

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

For traffic to flow between a subnet and an internet gateway, you must create a route rule accordingly in the subnet’s route table (for example, 0.0.0.0/0 > internet gateway). See UpdateRouteTable.

You must specify whether the internet gateway is enabled when you create it. If it’s disabled, that means no traffic will flow to/from the internet even if there’s a route rule that enables that traffic. You can later use UpdateInternetGateway to easily disable/enable the gateway without changing the route rule.

Example Usage

resource "oci_core_internet_gateway" "test_internet_gateway" {
	#Required
	compartment_id = var.compartment_id
	vcn_id = oci_core_vcn.test_vcn.id

	#Optional
	enabled = var.internet_gateway_enabled
	defined_tags = {"Operations.CostCenter"= "42"}
	display_name = var.internet_gateway_display_name
	freeform_tags = {"Department"= "Finance"}
	route_table_id = oci_core_route_table.test_route_table.id
}

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 Internet Gateway * update - (Defaults to 20 minutes), when updating the Internet Gateway * delete - (Defaults to 20 minutes), when destroying the Internet Gateway

Import

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

$ terraform import oci_core_internet_gateway.test_internet_gateway "id"