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

interpolationFuncElement issue after #785 #798

Closed
pmoust opened this issue Jan 14, 2015 · 4 comments
Closed

interpolationFuncElement issue after #785 #798

pmoust opened this issue Jan 14, 2015 · 4 comments

Comments

@pmoust
Copy link
Contributor

pmoust commented Jan 14, 2015

After #785 I get config: multi-variable must be in a slice during plan on many resources across our infrastructure configuration. A small sample is below that produces the err * resource 'aws_route_table_association.pph' config: multi-variable must be in a slice

variables.tf;

variable "zones" {
    default = {
        zone0 = "us-east-1b"
        zone1 = "us-east-1c"
        zone2 = "us-east-1e"
    }
}
variable "subnet_count" {
    description = "Number of subnets to use"
    default = 3
}

vpc.tf;

resource "aws_subnet" "pph" {
  vpc_id = "${aws_vpc.pph.id}"
  cidr_block = "${lookup(var.cidr_blocks, concat("zone", count.index))}"
  availability_zone = "${lookup(var.zones, concat("zone", count.index))}"

  tags {
        Name = "${lookup(var.subnet_tags, count.index)}"
  }

  count = "${var.subnet_count}"
  map_public_ip_on_launch = false
}

resource "aws_internet_gateway" "pph" {
    vpc_id = "${aws_vpc.pph.id}"
}

resource "aws_route_table" "pph" {
    vpc_id = "${aws_vpc.pph.id}"
    route {
        cidr_block = "0.0.0.0/0"
        gateway_id = "${aws_internet_gateway.pph.id}"
    }
}

resource "aws_route_table_association" "pph" {
    subnet_id       = "${element(aws_subnet.pph.*.id, count.index)}"
    route_table_id  = "${aws_route_table.pph.id}"
    count           = "${var.subnet_count}"
}
@pmoust
Copy link
Contributor Author

pmoust commented Jan 14, 2015

Terraform v0.3.7.dev (9ee3626+CHANGES)

@mitchellh
Copy link
Contributor

Good catch. I know exactly what this is. We don't have tests around this which I'll add now.

@mitchellh
Copy link
Contributor

Fixed!

yahyapo pushed a commit to yahyapo/terraform that referenced this issue Jan 16, 2015
@ghost
Copy link

ghost commented May 4, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants