我无法弄清楚这一点,它发生了几次,这次我无法解决它。
我从 terragrunt 得到的错误是
terragrunt.hcl:25,47-50:不支持的属性;此对象没有名为“id”的属性。
我的问题是我试图引用的 id 存在于 tfstate 中,为什么它看不到它?
terragrunt.hcl 下面的缩短代码
dependency "vm01" {
config_path = "../vm01"
}
include {
path = find_in_parent_folders()
}
terraform {
source = "//core/azurerm_virtual_machine_extension"
}
locals {
vm_name = "vm01"
}
inputs = {
name = local.vm_name
virtual_machine_id = dependency.vm01.id
.....
}
输出.hcl
output "id" {
value = azurerm_windows_virtual_machine.vm.id
}
tfstate 直接从后端存储帐户中提取
{
"version": 4,
"terraform_version": "0.14.7",
"serial": 4,
"lineage": "abcde-guid-abcde",
"outputs": {
"id": {
"value": "/subscriptions/abcde-guid-abcde/resourceGroups/rg-name/providers/Microsoft.Compute/virtualMachines/vm01",
"type": "string"
}
}
...........
}