Home > OS >  Value attribute is expected when creating aws internet gateway with terraform
Value attribute is expected when creating aws internet gateway with terraform

Time:11-10

I want to create an internet gateway with terraform. Following the [terraform documentation][1] I have the following block

resource "aws_internet_gateway" "prod-igw" {
    vpc_id = "${aws_vpc.prod-vpc.id}"
    tags = {{
        Name = "pos-igw"
    }
}

After applying I get this error message.

Error: Missing attribute value
Expected an attribute value, introduced by an equals sign ("=").

There's nothing about value in the documentation though. [1]: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway

CodePudding user response:

You have a typo:

resource "aws_internet_gateway" "prod-igw" {
    vpc_id = aws_vpc.prod-vpc.id
    tags = { # <--- there was an extra {
        Name = "pos-igw"
    }
}

Please make sure to use a modern IDE (e.g., VScode) where there is a terraform extension which will prevent these things from happening and you will not have to ask a question on SO.

  • Related