Terraform 使用网络接口安全组从AzureRM的v1迁移到v2时出现问题,无法应用
我正在将配置从azurerm 1.44迁移到2.3.0,需要使用新的配置项azurerm\网络\接口\安全\组\关联 当我完成我的计划时,一切似乎都很好: Terraform将执行以下操作:Terraform 使用网络接口安全组从AzureRM的v1迁移到v2时出现问题,无法应用,terraform,terraform-provider-azure,Terraform,Terraform Provider Azure,我正在将配置从azurerm 1.44迁移到2.3.0,需要使用新的配置项azurerm\网络\接口\安全\组\关联 当我完成我的计划时,一切似乎都很好: Terraform将执行以下操作: # module.web-msg.azurerm_network_interface_security_group_association.main[0] will be created + resource "azurerm_network_interface_security_group_ass
# 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" {
您需要共享您的terraform文件,以便社区能够为您提供正确的帮助。据我所知,vm-0和vm-1已经在您的tf配置中声明,对吗?你能分享他们的声明吗?你还在处理这个问题吗?我有半个月没有看到任何更新。我仍在后台处理它,但我认为需要导入azurerm_网络、接口、安全、组和计划与应用之间的关联。您需要提供地形代码,以便我能找到其中的错误。如果没有地形代码,我什么也做不了。你需要共享你的地形文件,这样社区才能给你正确的帮助。据我所知,vm-0和vm-1已经在你的tf配置中声明了,对吗?你能分享他们的声明吗?你还在处理这个问题吗?我有半个月没有看到任何更新。我仍在后台处理它,但我认为需要导入azurerm_网络、接口、安全、组和计划与应用之间的关联。您需要提供地形代码,以便我能找到其中的错误。如果没有地形代码,我什么也做不了。