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

Changes to azurerm_traffic_manager_profile destroys endpoints #6041

Closed
vidarw opened this issue Mar 9, 2020 · 7 comments · Fixed by #7846
Closed

Changes to azurerm_traffic_manager_profile destroys endpoints #6041

vidarw opened this issue Mar 9, 2020 · 7 comments · Fixed by #7846

Comments

@vidarw
Copy link
Contributor

vidarw commented Mar 9, 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

Terraform (and AzureRM Provider) Version

Affected Resource(s)

  • azurerm_traffic_manager_profile
  • azurerm_traffic_manager_endpoint

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

resource "azurerm_traffic_manager_profile" "api" {
  name                = "my-api"
  resource_group_name = var.resource_group_name
  traffic_routing_method = "Priority"

  dns_config {
    relative_name = "my-api.example.com"
    ttl           = 15
  }

  monitor_config {
    protocol                     = "https"
    port                         = 443
    path                         = "/health"
    interval_in_seconds          = 30
    timeout_in_seconds           = 5
    tolerated_number_of_failures = 3
    expected_status_code_ranges  = ["100-403"]
  }
}


resource "azurerm_traffic_manager_endpoint" "api_blue_endpoint" {
  name                = "my-api-blue"
  resource_group_name = var.resource_group_name
  profile_name        = azurerm_traffic_manager_profile.api.name

  target_resource_id = var.blue_ip_resource_id
  type               = "azureEndpoints"
  priority           = 10
  endpoint_status    = var.enable_blue == true ? "Enabled" : "Disabled"

  custom_header {
    name  = "Host"
    value = "my-apu."
  }
}

Debug Output

Panic Output

Expected Behavior

Changes to values in the azurerm_traffic_manager_profile should not affect the azurerm_traffic_manager_endpoint.

Actual Behavior

Changes to values in the azurerm_traffic_manager_profile like monitor_config.path or dns_config.ttl causes all the azurerm_traffic_manager_endpoint to disappear. You basically have to run terraform twice to reprovision them.

Steps to Reproduce

  1. terraform apply
  2. Change monitor_config.path from /health to /healthz.
  3. terraform apply

Your endpoints are now gone.

Important Factoids

References

  • #0000
@djsly
Copy link
Contributor

djsly commented Apr 6, 2020

Seeing the same thing here... doing any change to the profiles wipes the endpoints...

@djsly
Copy link
Contributor

djsly commented Apr 6, 2020

@katbyte / @tombuildsstuff how we do normally proceed with this type of debugging ? From what I can gather, it seems that something changed at the MSFT side maybe ? assuming this was never an issue before ?

We just caused major downtime by changing a simple monitor setting since it wiped ALL endpoints.

I looked at the terraform code and the traffic_manager_profiles resource doesn't set any endpoints. The model can receives a list, but instead terraform uses the azurerm_traffic_manager_endpoint resource.

https://github.com/Azure/azure-sdk-for-go/blob/master/services/trafficmanager/mgmt/2018-04-01/trafficmanager/models.go#L701

So... how is this normally reported to MSFT, knowing that making changes in the portal or AZ CLI doesn't affect it seems...

@simonlegeek
Copy link

We also kicked ourselves in the nuts with this bug trying to apply a simple change in resource tags. Does anyone have an update on this?

@nitzanm
Copy link
Contributor

nitzanm commented Jun 24, 2020

I've created a pull request with a fix: #7471 . It was attached to a closed/duplicate issue so I'm mentioning it here to make sure it's seen.

@djsly
Copy link
Contributor

djsly commented Jul 29, 2020

@nitzanm / @ArcturusZhang which of the two PR should I follow to know when this is ready ?

@katbyte I see you are reviewing #7846 , should we expect this in 2.21.0 ? :)

@katbyte katbyte added this to the v2.23.0 milestone Aug 11, 2020
katbyte pushed a commit that referenced this issue Aug 11, 2020
… longer destroys all the endpoints (#7846)

Fixes #6041
Supersedes #7471

Special thanks to @nitzanm

I also updated the test cases, since the relative_name in dns_config block is a ForceNew attribute, therefore it makes no sense to change in an update test case.
@ghost
Copy link

ghost commented Aug 13, 2020

This has been released in version 2.23.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 = "~> 2.23.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Sep 10, 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 Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.