4

Why do I get this error with Terraform,

The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment".

You can see the resource aws_internet_gateway_attachment defined in the docs. The full error is,

│ Error: Invalid resource type
│ 
│   on main.tf line 26, in resource "aws_internet_gateway_attachment" "example":
│   26: resource "aws_internet_gateway_attachment" "example" {
│ 
│ The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment".
╵

this is the hdl I'm using

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

I'm using version 3.75.1 of the AWS provider.

6
  • Add some code, at least the lines in question and probably a few above and below it.
    – kenlukas
    Commented May 12, 2022 at 12:06
  • @kenlukas updated. Commented May 12, 2022 at 17:15
  • 1
    What version of the aws provider are you using? It's possible that the resource you're attempting to use was released on a later version.
    – kenlukas
    Commented May 13, 2022 at 12:08
  • @kenlukas updated. Commented May 13, 2022 at 15:15
  • 1
    Please update your provider version to use that resource definition Commented May 14, 2022 at 12:42

1 Answer 1

3

The terraform docs default to the lastest, version. The doc page you're looking at is,

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway_attachment#attributes-reference

What you want to do is replace that latest with the version you're using, in this case 3.75.1. Like this,

https://registry.terraform.io/providers/hashicorp/aws/3.75.1/docs/resources/internet_gateway_attachment#attributes-reference

That brings up a 404,

This documentation page doesn't exist for version 3.75.1 of the aws provider.

Which basically means you must upgrade the Terraform provider.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.