Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_automation_module does not wait for import to complete. #3109

Closed
Laikulo opened this issue Mar 23, 2019 · 4 comments
Closed

azurerm_automation_module does not wait for import to complete. #3109

Laikulo opened this issue Mar 23, 2019 · 4 comments

Comments

@Laikulo
Copy link

Laikulo commented Mar 23, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.11.13
+ provider.azurerm v1.23.0

Affected Resource(s)

  • azurerm_automation_module

Terraform Configuration Files

main.tf

resource "azurerm_automation_account" "ctfautomation" {
  name                = "CTFAutomation"
  location            = "${var.location}"
  resource_group_name = "${var.resource_group}"

  sku {
    name = "Basic"
  }
}

resource "azurerm_automation_module" "profile" {
  name                    = "AzureRM.Profile"
  resource_group_name     = "${var.resource_group}"
  automation_account_name = "${azurerm_automation_account.ctfautomation.name}"

  module_link {
    uri = "https://psg-prod-eastus.azureedge.net/packages/azurerm.profile.4.6.0.nupkg"
  }
}

resource "azurerm_automation_module" "container_instance" {
  name                    = "AzureRM.ContainerInstance"
  resource_group_name     = "${var.resource_group}"
  automation_account_name = "${azurerm_automation_account.ctfautomation.name}"

  module_link {
    uri = "https://psg-prod-eastus.azureedge.net/packages/azurerm.containerinstance.0.2.12.nupkg"
  }

  depends_on = [
    "azurerm_automation_module.profile",
  ]
}

Azure CLI was used for authentication.

Debug Output

https://gist.github.com/KJ4IPS/98e05ac227b0099ecc2e691d69313dff

Note: powershell put a NativeCommandError in here, feel free to ignore it.

Panic Output

Terraform did not panic

Expected Behavior

Terraform should have waited for the fist module import (profile) to complete before importing the second (container_instance)

Actual Behavior

Terraform started the import of profile, then immedatly started the import of container_instance without waiting for profile to finish.

This lead to the failure of the container_instance import, as container_instance depends (in a powershell sense) on profile. (depends_on was used to ensure correct import order)

Additionally, terraform does not see the failed import as drift, so it will leave the failed import around until it is tainted, or drifts in some other aspect.

Steps to Reproduce

  1. terraform apply

References

@katbyte

This comment has been minimized.

@ahmddp
Copy link

ahmddp commented May 17, 2019

I've faced exactly the same problem.

My workaround was adding a 120-second delay between two azurerm_automation_modules.

resource "azurerm_automation_module" "AzureRMProfile" {
  name                    = "AzureRM.Profile"
  resource_group_name     = "${var.resource_group}"
  automation_account_name = "${azurerm_automation_account.myautomation.name}"

  module_link = {
    uri = "https://devopsgallerystorage.blob.core.windows.net/packages/azurerm.profile.5.8.3.nupkg"
  }
}

resource "null_resource" "delay" {
  provisioner "local-exec" {
    command = "sleep 120"
  }
  triggers = {
    "before" = "${azurerm_automation_module.AzureRMProfile.id}"
  }
}

resource "azurerm_automation_module" "AzureRMCompute" {
  name                    = "AzureRM.Compute"
  resource_group_name     = "${var.resource_group}"
  automation_account_name = "${azurerm_automation_account.myautomation.name}"

  module_link = {
    uri = "https://devopsgallerystorage.blob.core.windows.net/packages/azurerm.compute.5.9.1.nupkg"
  }

  depends_on = [
    "null_resource.delay"
  ]
}

@tombuildsstuff
Copy link
Contributor

hey @KJ4IPS @ahmddp

Thanks for opening this issue :)

Taking a quick look into this this appears to be a duplicate of #2600 - since that also includes some additional context around the ModuleProvisioningState field, I'm going to close this issue in favour of that one - would you mind subscribing to that one for updates?

Thanks!

@ghost
Copy link

ghost commented Jun 20, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants