Mock output with multiple indices


I’m running into an issue using mock output and running a plan.
When i use mock outputs on a variable with multiple entries which i iterate over, i get the following error in the plan:

This value does not have any indices.

The state file will eventually represents this when created:

"vpc_id": {
      "value": {
        "001": "vpc-xxxxxxxxxxxxxxxxxxx",
        "002": "vpc-yyyyyyyyyyyyyyyyyyy"

In the Terraform module i do an iteration over vpc_id["001"] etc.

I’ve tried multiple markups for the mock output, but can’t get it to work.
The up works, so the Terraform itself is valid.

Any help would be highly appreciated.

Kind regards,


Believe you’re trying to mock out a hash as the value.

Here’s an example of what you’re looking for:


somevar = <%= output("b1.length", mock: {"001" => "vpc-xxx", "002" => "vpc-yyy"}) %>

Building the stack:

$ terraspace build a1
Building .terraspace-cache/us-west-2/dev/stacks/a1
Built in .terraspace-cache/us-west-2/dev/stacks/a1

Results in


somevar = {"001":"vpc-xxx","002":"vpc-yyy"}