Terraform: invalid or unknown key: default_for_az

Created on 13 Feb 2017  ยท  8Comments  ยท  Source: hashicorp/terraform

Terraform Version

0.8.6

Affected Resource(s)

  • aws_subnet

Terraform Configuration Files


resource "aws_subnet" "main-1a" {
    vpc_id = "${aws_vpc.main.id}"
    cidr_block = "10.1.0.0/20"
    availability_zone = "${format("%s%s", var.region, "a")}"
    default_for_az = true
    map_public_ip_on_launch = true
}

Expected Behavior

The defined subnet gets set as the default subnet for the AZ.

Actual Behavior

  * aws_subnet.main-1a: : invalid or unknown key: default_for_az

Steps to Reproduce

  1. terraform plan
bug provideaws

Most helpful comment

Hi @jangrewe

you are mixing up data_sources and resources - we should try and make this much clearer in the documentation

Apologies for this

Paul

All 8 comments

Hi @jangrewe

Sorry for the issue here. This parameter is not part of Terraform - this is why the error is being returned

Thanks

Paul

Hi @stack72, i don't follow, it's mentioned in the docs?

https://www.terraform.io/docs/providers/aws/d/subnet.html

Argh, i just noticed that this was for the Data Source, not the Resource... my bad.

Hi @jangrewe

you are mixing up data_sources and resources - we should try and make this much clearer in the documentation

Apologies for this

Paul

I got a similar response while trying to set dns hostnames for a vpc invalid or unknown key: enable_dns_hostnames.

Did not realize the difference between data_resources and resources. As you noted would be nice to have this clearly documented.

resource "aws_instance" "test" {
ami = "ami-0ac019f4fcb7cb7e6"
key_name = "hello"
instance_type = "t2.micro"
tags = {
Name="test"
}

Error: aws_instance.test: invalid or unknown key: command

can anyone help me ???

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings