`terraspace all plan` produces errors


I have a configuration whereby multiple stacks are wired together using the technique as specified on the Deploy Multiple Stacks page.

The stacks seem to deploy successfully when issuing a terraspace all up, however when a terraspace all plan is issued a number of errors are encountered, for example:

│ Error: Invalid value for input variable
│   on 2-base.auto.tfvars line 13:
│   13: private_subnet_ids = "(Output private_subnet_ids was not found for the eks-cluster tfvars file. Either htp-config stack has not been deployed yet or it does not have this output: private_subnet_ids. Also, if local backend is being used and has been removed/cleaned, then it will also result zero-byte state.json with the 'terraform state pull' used to download the terraform state and output will not be found.)"

Everything appears to check out as the stacks all deploy fine when doing an all up command.

There are also a few “undeclared variable” errors which creep in, but again these all check out when walking through the module and stack dependencies.

Any ideas?


Think will change the behavior so it returns a null value instead of the string. It’ll just log the warning. Unsure when will get to it. Will get to it though. Will consider PRs. Of course no sweat either way :+1:

Hi @tung,

Thanks for the response. Any ideas why it might be happening in the first place?

Is the plan all not able to resolve the necessary values?

Unsure. The source code with the output helper for context might be helpful.

So made no real progress with this. The issue is partly made worse when the ERB output call returns the error as a string, and this can cause issues when the expectant variable type is say a map or a list.

it would be much better if the fucntion somehow returned the equivalent of null so this could be catered for with Terrarform default values and nullable = false

And getting Ruby to return anything like the correct type is just an ugly hack I’d rather not go down.

Yup. Agree with this. The output helper should return null instead of a String. Hope to get to it in the next major release of Terraspace. Been working on terraspace more lately but it might still a while off.