Resource: aws_internet_gateway

Provides a resource to create a VPC Internet Gateway.

Example Usage

resource "aws_internet_gateway" "gw" {
  vpc_id = aws_vpc.main.id

  tags = {
    Name = "main"
  }
}

Argument Reference

This resource supports the following arguments:

resource "aws_internet_gateway" "gw" {
  vpc_id = aws_vpc.main.id
}

resource "aws_instance" "foo" {
  # ... other arguments ...

  depends_on = [aws_internet_gateway.gw]
}

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import Internet Gateways using the id. For example:

import {
  to = aws_internet_gateway.gw
  id = "igw-c0a643a9"
}

Using terraform import, import Internet Gateways using the id. For example:

% terraform import aws_internet_gateway.gw igw-c0a643a9