我正在使用Terraform(0.11.1)来配置Azure资源,并且使用连接到NIC创建的本地exec配置程序(azurerm_network_interface)遇到了一个奇怪的问题 .
这是Terraform代码:
resource "azurerm_network_interface" "nnic" {
name = "nnic"
location = "West US"
resource_group_name = "${azurerm_resource_group.nresourcegroup.name}"
network_security_group_id = "${azurerm_network_security_group.nnsg.id}"
ip_configuration {
name = "nnic-config"
subnet_id = "${azurerm_subnet.nsubnet.id}"
private_ip_address_allocation = "dynamic"
public_ip_address_id = "${azurerm_public_ip.npublicip.id}"
}
provisioner "local-exec" {
command= "./add-all-dns.sh ${var.resourcename} ${azurerm_public_ip.npublicip.ip_address}"
}
provisioner "local-exec" {
command= "./remove-all-dns.sh ${var.resourcename} ${azurerm_public_ip.npublicip.ip_address}"
when = "destroy"
}}
add_all_dns.sh和remove_all_dns.sh是管理DNS记录创建的shell脚本 .
我看到NIC被分配并创建了DNS条目 .
这些脚本在退出之前会立即显示日志语句,并显示这些日志消息 .
然而,NIC创建永远不会完成,我们只会连续不断地进行
azurerm_network_interface.nnic:还在创造......
消息 .
有没有人知道为什么脚本完成没有注册Terraform配置器?