Terraform: data source aws_vpcs filter breaks in terrafrom version 0.12.0

Created on 23 May 2019  ยท  10Comments  ยท  Source: hashicorp/terraform

If your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers .
-->data source aws_vpcs

Terraform Version: 0.12.0, aws provider 2.12.0

If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed.
--> upgrading caused the issue, rolled back to 11.14

Terraform Configuration Files

data "aws_vpcs" "id" {
  filter = {
    name = "tag-value",
    values = ["${var.vpc_name}"]
  }
}

output "aws_vpc_id" {
  value = "${data.aws_vpcs.id.ids}"
}

Debug Output

Error: Unsupported argument
`
  on main.tf line 17, in data "aws_vpcs" "id":
  17:   filter = {

An argument named "filter" is not expected here. Did you mean to define a
block of type "filter"?

Crash Output

Error: Unsupported argument

  on main.tf line 17, in data "aws_vpcs" "id":
  17:   filter = {

An argument named "filter" is not expected here. Did you mean to define a
block of type "filter"?

Expected Behavior

Should be able to enter a VPC name and get the VPC-ID back

Actual Behavior

See crash/debug above

Steps to Reproduce

Used terrafrom version 0.12.0
terraform plan with the above code snipet against AWS provider

Additional Context

This known to work in versions 0.11.13~.14

bug

Most helpful comment

Hi @kenk667!

Could you try running your configuration through terraform 0.12upgrade and see if that helps? It looks like your configuration is still in the 0.11-oriented syntax. The upgrade tool should fix this by removing that equals sign from the filter block; I know you said you tried that already, but I'd like to see if doing it in conjunction with the other updates the upgrade tool makes improves the situation.

All 10 comments

and the equal sign after filter doesn't make a difference either, tried both ways

Hi @kenk667! Thanks for reporting this issue, and I'm sorry you've come across it.

For clarification: I suspect there's a copy paste error in your report: the current aws provider version is v2.11.0. Can you paste the full output from terraform version?

PS: I updated your comment, but the only change I made was wrapping your code and error examples in triple back-ticks (```) for formatting.

terraform -v
Terraform v0.11.14

  • provider.aws v2.11.0

thank you!

Hi @kenk667!

Could you try running your configuration through terraform 0.12upgrade and see if that helps? It looks like your configuration is still in the 0.11-oriented syntax. The upgrade tool should fix this by removing that equals sign from the filter block; I know you said you tried that already, but I'd like to see if doing it in conjunction with the other updates the upgrade tool makes improves the situation.

I tried it and the first surprising thing it choked on was

terraform {
required_version =

I also ran terraform 0.12checklist while running version 0.11.14 and didn't choke on where the issue is

discovered a new issue with the upgrade switch...can't name a module starting with a number, is this intentional?

got the issue resolved

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