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_function_app should wait for function deployment #8415

Open
sschmeck opened this issue Sep 10, 2020 · 5 comments
Open

azurerm_function_app should wait for function deployment #8415

sschmeck opened this issue Sep 10, 2020 · 5 comments

Comments

@sschmeck
Copy link
Contributor

sschmeck commented Sep 10, 2020

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

Description

When you define a azurerm_function_app with a fixed function artifact using app_settings.WEBSITE_RUN_FROM_PACKAGE, sometimes the apply fails. Since the azurerm_function_app creation finished before the artifact is deployed successfully, subsequent resources like azurerm_eventgrid_event_subscription fail.

Error: Error waiting for EventGrid Event Subscription "example" (Scope "/subscriptions/ae79848e-00d9-4ec8-bf5a-0f9768bb3d3a/resourceGroups/07245d2fhir/providers/Microsoft.EventGrid/topics/example") to become available: Code="Endpoint validation" Message="Destination azure endpoint not found. Resource details: resourceId: /subscriptions/.../resourceGroups/example/providers/Microsoft.Web/sites/example/functions/example. Resource should pre-exist before attempting this operation. Activity id:09a829bc-a0dc-4545-8085-6b3f69cac2aa, timestamp: 7/24/2020 1:24:11 PM (UTC)."
  on ../../infrastructure/functions.tf line 48, in resource "azurerm_eventgrid_event_subscription" "example":
  48: resource "azurerm_eventgrid_event_subscription" "example" {

Therefore the azurerm_function_app should check for a deployment and wait until it has finished.

New or Affected Resource(s)

  • azurerm_function_app

References

  • #0000
@sschmeck sschmeck changed the title azurerm_function_app should wait for function deployment when provided azurerm_function_app should wait for function deployment Sep 10, 2020
@jonathanmedd
Copy link

We have the same problem. Need to create multiple event subscriptions in different Azure subscriptions utilising the same Azure function in a function app in it's own subscription. They get created simultaneously, some are successfully deployed by terraform and some fail with the same error above.

To workaround it for now we use a time_sleep resource for a couple of mins to give sufficient time for the functions in the function app to become available after being deployed from blob storage via the WEBSITE_RUN_FROM_PACKAGE app setting.

Not ideal, but it's OK until this issue gets resolved.

@vagharshakus

This comment was marked as off-topic.

@vagharshakus
Copy link

if somebody is still struggling with this issue, because of f.e. long-runnung local-exec, deploying function code, here a workaround: https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep

@fardarter

This comment was marked as off-topic.

@vmille
Copy link

vmille commented Oct 8, 2022

Hi,
sorry, but even with the sleep, no luck. Do you know if there is another workaround ?
No issue if I create the subscription by the portal.

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants