Я переношу свою конфигурацию с Azurerm 1.44 на 2.3.0 и мне нужно использовать новый элемент конфигурации azurerm_network_interface_security_group_association
Когда я выполняю свой план, все кажется хорошим:
Terraform выполнит следующие действия:
# module.web-msg.azurerm_network_interface_security_group_association.main[0] will be created
+ resource "azurerm_network_interface_security_group_association" "main" {
+ id = (known after apply)
+ network_interface_id = "/subscriptions/xxxx/resourceGroups/vm-0/providers/Microsoft.Network/networkInterfaces/vm-0-nic"
+ network_security_group_id = "/subscriptions/xxxx/resourceGroups/vm-0/providers/Microsoft.Network/networkSecurityGroups/MsgHubNetworkSecurityGroup"
}
# module.web-msg.azurerm_network_interface_security_group_association.main[1] will be created
+ resource "azurerm_network_interface_security_group_association" "main" {
+ id = (known after apply)
+ network_interface_id = "/subscriptions/xxxx/resourceGroups/vm-1/providers/Microsoft.Network/networkInterfaces/vm-1-nic"
+ network_security_group_id = "/subscriptions/xxxx/resourceGroups/vm-1/providers/Microsoft.Network/networkSecurityGroups/MsgHubNetworkSecurityGroup"
}
Но когда я подаю заявку, я получаю это, что не имеет смысла, поскольку ресурс "vm-0" управляется terraform.
terraform apply .\the.plan
module.web-msg.azurerm_network_interface_security_group_association.main[0]: Creating...
module.web-msg.azurerm_network_interface_security_group_association.main[1]: Creating...
Error: A resource with the ID "vm-0" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_interface_security_group_association" for more information.
on ..\..\..\infra\terraform\global\msghub\main.tf line 52, in resource "azurerm_network_interface_security_group_association" "main":
52: resource "azurerm_network_interface_security_group_association" "main" {
Error: A resource with the ID "vm-1" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_interface_security_group_association" for more information.
on ..\..\..\infra\terraform\global\msghub\main.tf line 52, in resource "azurerm_network_interface_security_group_association" "main":
52: resource "azurerm_network_interface_security_group_association" "main" {