Team,
Am using the terraform plan output to apply/destroy the infra. While using the destroy
with the plan output, it’s throwing an error due to the output.conf
. Is there a way to avoid executing output.tf
when applying the destroy plan output?
FYI: output.tf
is working fine with the plan and apply and throwing error with the apply with the destroy.out.
Work flow:
terraform plan -destroy --out=destroy.plan
> > Solicit Approval <<
terraform apply destroy.plan --auto-approve
Error:
+ terraform apply -auto-approve destroy.tfplan
local_file.render-vars: Destroying... [id=d3c23a19203e951f3c5b487bea62f35ae9689b40]
local_file.render-inventory: Destroying... [id=975618cb35e11872b89e50e8586fcc1b7cdbbe3b]
local_file.render-inventory: Destruction complete after 0s
local_file.render-vars: Destruction complete after 0s
module.server_vm.vsphere_virtual_machine.generic_vm[0]: Destroying... [id=42198817-56e4-f954-1f6b-486cf1fd434a]
module.client_vm.vsphere_virtual_machine.generic_vm[0]: Destroying... [id=42199433-7acb-ce1f-cb80-2e18ef8e6737]
module.client_vm.vsphere_virtual_machine.generic_vm[0]: Destruction complete after 9s
module.server_vm.vsphere_virtual_machine.generic_vm[0]: Destruction complete after 9s
Error: Error in function call
on .terraform/modules/client_vm/output.tf line 4, in output "server_details":
4: value = zipmap(
5:
6:
7:
|----------------
| var.generic_vm_type is tuple with 1 element
| vsphere_virtual_machine.generic_vm is empty tuple
Call to function "zipmap" failed: number of keys (1) does not match number of
values (0).
Error: Error in function call
on .terraform/modules/server_vm/output.tf line 4, in output "server_details":
4: value = zipmap(
5:
6:
7:
|----------------
| var.generic_vm_type is tuple with 1 element
| vsphere_virtual_machine.generic_vm is empty tuple