Resource: aws_internet_gateway_attachment

Provides a resource to create a VPC Internet Gateway Attachment.

Example Usage

resource "aws_internet_gateway_attachment" "example" {
  internet_gateway_id = aws_internet_gateway.example.id
  vpc_id              = aws_vpc.example.id
}

resource "aws_vpc" "example" {
  cidr_block = "10.1.0.0/16"
}

resource "aws_internet_gateway" "example" {}

Argument Reference

This resource supports the following arguments:

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 Gateway Attachments using the id. For example:

import {
  to = aws_internet_gateway_attachment.example
  id = "igw-c0a643a9:vpc-123456"
}

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

% terraform import aws_internet_gateway_attachment.example igw-c0a643a9:vpc-123456