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_log_profile creation fails due to replication lag #4559

Closed
tiwood opened this issue Oct 8, 2019 · 2 comments · Fixed by #5194
Closed

azurerm_log_profile creation fails due to replication lag #4559

tiwood opened this issue Oct 8, 2019 · 2 comments · Fixed by #5194

Comments

@tiwood
Copy link
Contributor

tiwood commented Oct 8, 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 0.12.10 / provider.azurerm 1.35.0

Affected Resource(s)

  • azurerm_log_profile

Debug Output

Error: Error retrieving Log Profile "foobar": insights.LogProfilesClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="Log profile 'foobar' under scope '/subscriptions/xxxx' doesn't exist."

  on ../../../modules/ui_workload/main.tf line 261, in resource "azurerm_monitor_log_profile" "workload_log_profile":
 261: resource "azurerm_monitor_log_profile" "workload_log_profile" {

Expected Behavior

Log profile is created without error messages.

Actual Behavior

Log profile is created but due to replication lag Terraform sometimes gets a 404 response.

Steps to Reproduce

Create a basic log profile and run terraform apply
Note: This works in most cases so you may have to retry a few times.

Important Factoids

In most cases this works as expected but sometimes the replication takes a few seconds longer or you are asking an API endpoint which may not have the latest update due to lag.

There is already a retry function in place, but this sometimes isn't enough:

  1. Create gets 201 response
  2. Retry gets 200 response
  3. 3rd read gets 404 due to replication lag

How should we approach this? Should we add a sleep after the creation? (meh)

Relevant code:
https://github.com/terraform-providers/terraform-provider-azurerm/blob/9608d186084427707a806a4c25e3092f89584d0b/azurerm/resource_arm_monitor_log_profile.go#L142

@ghost
Copy link

ghost commented Jan 8, 2020

This has been released in version 1.40.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.40.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 28, 2020

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 👉 [email protected]. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants