不能在应用项目后为地形在本地打印变量.应用后已知地形打印



我尝试在应用项目后在本地为地形打印变量。应用后已知地形打印。Terraform版本为v0.14.5

主代码https://github.com/patsevanton/terraform-yandex-cloud-examples/blob/main/terraform-count/inventory.tf

locals {
name_attribute = "fqdn"
group_tag = "labels"
instances = concat(
yandex_compute_instance.vm_1, yandex_compute_instance.vm_2
)
.........
}

我运行terraform apply, terraform创建的资源

yandex_vpc_network.network-1: Creating...
yandex_vpc_network.network-1: Creation complete after 2s [id=enp6dunid3n9lritpr4j]
yandex_vpc_subnet.subnet-1: Creating...
yandex_vpc_subnet.subnet-1: Creation complete after 0s [id=e9ba67sdgqfkni8n9ks5]
yandex_compute_instance.vm_1[0]: Creating...
yandex_compute_instance.vm_1[0]: Still creating... [10s elapsed]
yandex_compute_instance.vm_1[0]: Still creating... [20s elapsed]
yandex_compute_instance.vm_1[0]: Creation complete after 26s [id=fhmncj5leton3br3nch9]
local_file.inventory: Creating...
local_file.inventory: Creation complete after 0s [id=c7377ed426dbf44a250a9293afd2dc55e6c279c5]
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
Outputs:
inventory_file = "./inventory.yaml"

我运行terraform console

terraform console
> local.instances
(known after apply)

如何在应用项目后在本地为地形打印变量?

根据评论

问题是由缺失引起的vm_2实例。添加实例后,local.instancesterraform console中正常工作。

最新更新