Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Value attribute is expected when creating aws internet gateway with terraform

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading