Terraform-provider-azurerm: Changes to azurerm_traffic_manager_profile destroys endpoints

Created on 9 Mar 2020  ·  7Comments  ·  Source: terraform-providers/terraform-provider-azurerm

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
bug servictraffic-manager

Most helpful comment

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?

All 7 comments

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

@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...

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?

I've created a pull request with a fix: https://github.com/terraform-providers/terraform-provider-azurerm/pull/7471 . It was attached to a closed/duplicate issue so I'm mentioning it here to make sure it's seen.

@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 ? :)

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 ...

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!

Was this page helpful?
0 / 5 - 0 ratings