gpt4 book ai didi

azure - 无法理解 Terraform "interpolation"技术或方法

转载 作者:行者123 更新时间:2023-12-03 04:14:20 25 4
gpt4 key购买 nike

我无法理解以下 terraform 插值产生错误的问题是什么?

resource "azurerm_network_interface" "tf-ni-cluster" {
count = 2
name = "${ax_base_hostname}-ni-${count.index}"
location = "${azurerm_resource_group.tf-rg-cluster.location}"
resource_group_name = "${azurerm_resource_group.tf-rg-cluster.name}"

ip_configuration {
name = "testConfiguration"
subnet_id = "${azurerm_subnet.tf-sn-cluster.id}"
private_ip_address_allocation = "dynamic"
}
}

错误消息如下:

terraform :
At line:1 char:1
+ terraform plan
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

Error: azurerm_network_interface.tf-ni-cluster: 2 error(s) occurred:
* azurerm_network_interface.tf-ni-cluster[0]: invalid variable syntax: "ax_base_hostname". Did you mean 'var.ax_base_hostname'? If this is part of inline `template`
parameter
then you must escape the interpolation with two dollar signs. For
example: ${a} becomes $${a}.
* azurerm_network_interface.tf-ni-cluster[1]: invalid variable syntax: "ax_base_hostname". Did you mean 'var.ax_base_hostname'? If this is part of inline `template`
parameter
then you must escape the interpolation with two dollar signs. For
example: ${a} becomes $${a}.

提前致谢!

最佳答案

错误已修复,在错误消息中。应该使用 "${var.ax_base_hostname}-${count.index}"

关于azure - 无法理解 Terraform "interpolation"技术或方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54453704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com