aws-ia / terraform-aws-vpc

AWS VPC Module
https://registry.terraform.io/modules/aws-ia/vpc/aws/latest
Apache License 2.0
92 stars 98 forks source link

Possible bug with tags module #73

Closed jslevin4 closed 2 years ago

jslevin4 commented 2 years ago

We are seeing an error recently. Our use of the module looks like this:

module "vpc" {
  source  = "aws-ia/vpc/aws"
  version = ">= 1.0.0"
...

And we're seeing this now in the terraform output:

Error: Unsupported argument

  on .terraform/modules/vpc/data.tf line 68, in module "tags":
  68:   tags = var.tags

An argument named "tags" is not expected here.

Hmm. Any ideas? Thanks!

jslevin4 commented 2 years ago

Not sure what this is. I know this line 68 in data.tf hasn't changed in a while, so maybe this is something unrelated. Thanks.

jslevin4 commented 2 years ago

This appeared to only happen when we were using terraform v1.2.7. Reverting to v1.2.6 caused it to start working again.

drewmullen commented 2 years ago

👋 Thanks for opening this issue! I'm not currently able to replicate 🤔

I've updated to 1.2.7 and I'm passing

module "vpc" {
  source  = "aws-ia/vpc/aws"
  version = ">= 2.0.0"

  name       = "multi-az-vpc"
  cidr_block = "10.0.0.0/20"
  az_count   = 2

  subnets = {
    public = {
      name_prefix               = "my-public" # omit to prefix with "public"
      netmask                   = 24
      nat_gateway_configuration = "all_azs" # options: "single_az", "none"
    }

    private = {
      # omitting name_prefix defaults value to "private"
      # name_prefix  = "private"
      netmask                 = 24
      connect_to_public_natgw = true
    }
  }

  vpc_flow_logs = {
    log_destination_type = "cloud-watch-logs"
    retention_in_days    = 180
    kms_key_id           = var.kms_key_id
  }

  tags = {
    "key" = "value"
  }
}
jslevin4 commented 2 years ago

Ah that's great that it's still working for you. Our team here at ASU seemed to think it was related to this issue in Terraform 1.2.7: https://github.com/hashicorp/terraform/issues/31615 And we're still on version 1 of the vpc module for now until we migrate. But I think we have a workaround for now. Thanks!

jslevin4 commented 2 years ago

And apparently it seems that issue is related to caching of modules in the terraform registry, not necessarily to any changes in terraform 1.2.7. What a tangled web we weave.. Hehe.

drewmullen commented 2 years ago

very glad there was no issue! again, thanks for reporting!