(apologies in advance for the length of this post)
I have two stacks: application
depends on peered-vnets
.
When I execute a terraspace all plan
, I notice that some of my variables in the application
stack are not being resolved. After some sleuthing, I discovered that the downloaded peered-vnet
tfstate files is zero bytes.
Here’s what I see when I enable debug logging:
Downloading tfstate for stack: peered-vnets
=> terraform init -get -input=false >> /tmp/terraspace/log/init/peered-vnets.log
=> cd /home/me/Projects/cloud-infrastructure/.terraspace-cache/canadacentral/dev/stacks/peered-vnets && terraform state pull > /tmp/terraspace/remote_state/stacks/peered-vnets/state.json
Notice the resulting file is zero bytes:
$ ls -l /tmp/terraspace/remote_state/stacks/peered-vnets/state.json
-rw-rw-r--. 1 me me 0 Jan 26 15:13 /tmp/terraspace/remote_state/stacks/peered-vnets/state.json
However… I can do the following without any issues:
$ export ARM_TENANT_ID=00000000-0000-0000-0000-000000000000
$ export ARM_SUBSCRIPTION_ID=00000000-0000-0000-0000-000000000000
$ export ARM_CLIENT_ID=00000000-0000-0000-0000-000000000000
$ export ARM_CLIENT_SECRET=00000000-0000-0000-0000-000000000000
$ cd /home/me/Projects/cloud-infrastructure/.terraspace-cache/canadacentral/dev/stacks/peered-vnets
$ terraform init
...
Terraform has been successfully initialized!
...
$ terraform state pull
{
"version": 4,
"terraform_version": "1.1.4",
...
}
I’m wondering if perhaps the terraform init
in the debug output is being executed before the cd /home/.../peered-vnets
command, resulting in an uninitialized backend? The debug output seems to suggest that, but I really don’t know for sure.
Any help would be greatly appreciated.
Just for completion sake, here’s what I was seeing in the terraspace output:
DEBUG: (Output vnet_subnets was not found for the application tfvars file. Either peered-vnets stack has not been deployed yet or it does not have this output: vnet_subnets)