在应用项目后,无法打印terraform的本地变量。应用后已知的地形打印

在应用项目后,无法打印terraform的本地变量。应用后已知的地形打印,terraform,Terraform,我尝试在应用项目后为terraform打印本地变量。应用后已知的地形打印。地形版本为v0.14.5 主代码 我运行terraformapply,terraform创建了资源 yandex_vpc_network.network-1: Creating... yandex_vpc_network.network-1: Creation complete after 2s [id=enp6dunid3n9lritpr4j] yandex_vpc_subnet.subnet-1: Creating..

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

主代码

我运行
terraformapply
,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控制台

terraform console
> local.instances
(known after apply)
如何在应用项目后为terraform打印本地变量?

基于注释


问题是由于缺少
vm_2
实例造成的。添加实例后,
local.instances
terraform控制台中按预期工作

您的
local.instances是什么?您是否有任何代码示例来说明它是如何获得的?您的输出显示您只创建了
vm_1
。您的
local.instances
中存在的
vm_2
呢?您是对的!非常感谢!我不创建vm_2。创建vm_2后,在terraform控制台中显示local.instances。请回答问题。
terraform console
> local.instances
(known after apply)