hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.76k stars 9.56k forks source link

Azure Private DNS destroys the VM #27364

Closed khandujaniket closed 3 years ago

khandujaniket commented 3 years ago

I have two azure TF modules

  1. Linux Virtual Machine
  2. Private DNS

I am using Terragrunt as a wrapper on TF. Private DNS is dependent on Virtual Machine and this dependency is maintained in Terragrunt.

Terraform Version

0.14.3

When I execute the Terragrunt apply-all following happens

  1. VM is created and output is presented
  2. Then Private DNS starts provisioning and then it starts destroying the VM. I am unable to pin point the issue.

I have a single state file for both modules.

terraform apply -no-color -input=false -auto-approve Acquiring state lock. This may take a few moments... tls_private_key.ssh: Refreshing state... [id=178eebbd453724bd63cdee4deba03b82cd31c284] local_file.private_key[0]: Refreshing state... [id=3eb0bb67ac9ff933ca5a58027cbf4f32e2689a64] data.azurerm_virtual_network.virtual_network: Refreshing state... azurerm_resource_group.jump_resource_group[0]: Refreshing state... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360] azurerm_network_interface.network_interface: Refreshing state... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360/providers/Microsoft.Network/networkInterfaces/nic-dev288-jumphost-mso360] azurerm_linux_virtual_machine.jump_machine: Refreshing state... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360/providers/Microsoft.Compute/virtualMachines/vm-dev288-jumphost-mso360] azurerm_resource_group.private_dns_resource_group[0]: Creating... azurerm_linux_virtual_machine.jump_machine: Destroying... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360/providers/Microsoft.Compute/virtualMachines/vm-dev288-jumphost-mso360] azurerm_resource_group.private_dns_resource_group[0]: Creation complete after 4s [id=/subscriptions/**/resourceGroups/rg_pdns_RG-dev288-01_mso360] azurerm_private_dns_zone.private_dns: Creating... azurerm_linux_virtual_machine.jump_machine: Still destroying... [id=/subscriptions/**-...alMachines/vm-dev288-jumphost-mso360, 10s elapsed] azurerm_private_dns_zone.private_dns: Still creating... [10s elapsed] azurerm_linux_virtual_machine.jump_machine: Still destroying... [id=/subscriptions/**-...alMachines/vm-dev288-jumphost-mso360, 20s elapsed] azurerm_private_dns_zone.private_dns: Still creating... [20s elapsed] azurerm_linux_virtual_machine.jump_machine: Still destroying... [id=/subscriptions/**-...alMachines/vm-dev288-jumphost-mso360, 30s elapsed] azurerm_private_dns_zone.private_dns: Still creating... [30s elapsed] azurerm_linux_virtual_machine.jump_machine: Still destroying... [id=/subscriptions/**-...alMachines/vm-dev288-jumphost-mso360, 40s elapsed] azurerm_private_dns_zone.private_dns: Creation complete after 38s [id=/subscriptions/**/resourceGroups/rg_pdns_rg-dev288-01_mso360/providers/Microsoft.Network/privateDnsZones/skyblue.corp.amdocs.azr] azurerm_private_dns_a_record.records["dev288-jumphost"]: Creating... azurerm_private_dns_zone_virtual_network_link.private_dns_link: Creating... azurerm_private_dns_a_record.records["dev288-jumphost"]: Creation complete after 5s [id=/subscriptions/**/resourceGroups/rg_pdns_rg-dev288-01_mso360/providers/Microsoft.Network/privateDnsZones/skyblue.corp.amdocs.azr/A/dev288-jumphost] azurerm_linux_virtual_machine.jump_machine: Still destroying... [id=/subscriptions/**-...alMachines/vm-dev288-jumphost-mso360, 50s elapsed] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [10s elapsed] azurerm_linux_virtual_machine.jump_machine: Destruction complete after 1m0s tls_private_key.ssh: Destroying... [id=178eebbd453724bd63cdee4deba03b82cd31c284] azurerm_network_interface.network_interface: Destroying... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360/providers/Microsoft.Network/networkInterfaces/nic-dev288-jumphost-mso360] tls_private_key.ssh: Destruction complete after 0s azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [20s elapsed] azurerm_network_interface.network_interface: Still destroying... [id=/subscriptions/**-...nterfaces/nic-dev288-jumphost-mso360, 10s elapsed] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [30s elapsed] azurerm_network_interface.network_interface: Destruction complete after 13s azurerm_resource_group.jump_resource_group[0]: Destroying... [id=/subscriptions/**/resourceGroups/rg_RG-dev288-01_mso360] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [40s elapsed] azurerm_resource_group.jump_resource_group[0]: Still destroying... [id=/subscriptions/**-...urceGroups/rg_RG-dev288-01_mso360, 10s elapsed] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [50s elapsed] azurerm_resource_group.jump_resource_group[0]: Still destroying... [id=/subscriptions/**-...urceGroups/rg_RG-dev288-01_mso360, 20s elapsed] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Still creating... [1m0s elapsed] azurerm_resource_group.jump_resource_group[0]: Still destroying... [id=/subscriptions/**-...urceGroups/rg_RG-dev288-01_mso360, 30s elapsed] azurerm_private_dns_zone_virtual_network_link.private_dns_link: Creation complete after 1m10s [id=/subscriptions/**/resourceGroups/rg_pdns_rg-dev288-01_mso360/providers/Microsoft.Network/privateDnsZones/skyblue.corp.amdocs.azr/virtualNetworkLinks/vnet-dns-link] azurerm_resource_group.jump_resource_group[0]: Still destroying... [id=/subscriptions/**-...urceGroups/rg_RG-dev288-01_mso360, 40s elapsed] azurerm_resource_group.jump_resource_group[0]: Destruction complete after 49s

danieldreier commented 3 years ago

Hello

We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help. The GitHub issues here are monitored only by our few core maintainers.

Based on the information you've provided, I don't immediately see evidence of a bug in Terraform core, though I also don't entirely understand what is causing this. It's possible that there's a defect, but there's not quite enough evidence here for me to treat it as one. There are two possible next steps for you:

  1. I think your best bet is to seek support on the community forum.

  2. Alternatively, if you can provide a simplified, full example here of a terraform config that I can run to reproduce an issue in which explicit output dependencies are ignored, I may be able to confirm that this is a defect in core or the AWS provider and get it on our backlog. We don't maintain Terragrunt, so if your reproduction case requires Terragrunt, you should report it to that project. If you are able to craft a simple reproduction that shows a bug in Terraform Core without Terragrunt, I'm happy to help investigate.

I'm going to close this for now, because I think the community forum is the right approach. Feel free to leave a note or contact me at ddreier@hashicorp.com to re-open this if you'd rather work up a repro case here.

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.