Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid map lookups cause evaluation errors #157

Closed
joestump opened this issue Nov 12, 2017 · 1 comment
Closed

Valid map lookups cause evaluation errors #157

joestump opened this issue Nov 12, 2017 · 1 comment
Labels

Comments

@joestump
Copy link

joestump commented Nov 12, 2017

I've got some HCL code that looks like this:

subnet_cidr_blocks = "${var.subnet_cidr_blocks["staging1"]}"

var.subnet_cidr_blocks is a map of lists with assigned CIDR blocks. It looks like this:

variable "subnet_cidr_blocks" {
  description = "Two subnets per environment"
  type        = "map"

  default = {
    production = ["10.0.7.0/24", "10.0.8.0/24"]
    staging1   = ["10.0.9.0/24", "10.0.10.0/24"]
  }
}

When I run tflint I get the following error:

Evaluation error: 1:31: unknown variable accessed: staging1 in staging1.tf:9

The only thing that works is lookup(), but you can't use that function on maps of lists. Only maps of strings.

@wata727
Copy link
Member

wata727 commented Nov 12, 2017

Oops, I noticed that I made a very basic mistake.
I will fix this problem soon and release the fixed version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants