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

Regenerating azurerm_traffic_manager_profile orphans azurerm_traffic_manager_endpoint resources #763

Closed
jcleavel opened this issue Jan 26, 2018 · 6 comments
Assignees
Labels
bug service/traffic-manager upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc)

Comments

@jcleavel
Copy link

jcleavel commented Jan 26, 2018

EDIT 1/29/2017:

As it turns out, changing the dns_config property does force recreating the traffic manager profile, while changes to the monitor_config does NOT force recreation, but the endpoint resources are still orphaned regardless of the change.


Hi there,

I'm having an issue that when I am forced to regenerate an azurerm_traffic_manager_profile resource, the associated azurerm_traffic_manager_endpoint resources get quietly orphaned from their parent resource and are not regenerated. This results in my traffic manager being regenerated without any endpoints!

These concerns over dependent resource lifecycles appears to to be pretty much the same problem that's described in issue #240 on the AWS provider repo, but I think that just fixing this may not be enough of a solution. That problem needs to be addressed, but the real issue here may be that my traffic manager is getting regenerated when the only thing I change is a value on the monitor_config parameter.

Expected Behavior

When an azurerm_traffic_manager_profile is regenerated, any azurerm_traffic_manager_endpoint resources associated with it are also regenerated.

Also: Changing the monitor_config or dns_config parameters on an azurerm_traffic_manager_profile resource should be low-impact and not destroy resources.

Actual Behavior

Regenerating an azurerm_traffic_manager_profile resource leaves its dependent azurerm_traffic_manager_endpoint resources orphaned and does not recreate them.

Also: Changing non-destructive parameters destroys and regenerates the resource, adding significant risk to modifying an existing, production-deployed resource.

Terraform Version

Terraform v0.11.2
+ provider.azurerm v1.0.1

Affected Resource(s)

Please list the resources as a list, for example:

  • azurerm_traffic_manager_profile
  • azurerm_traffic_manager_endpoint

Terraform Configuration Files

# ***** Traffic Manager *****
resource "azurerm_traffic_manager_profile" "tm" {
    name                             = "${var.traffic_manager_name}"
    resource_group_name  = "${data.azurerm_resource_group.rg.name}"
    traffic_routing_method = "Weighted"

    dns_config {
        relative_name = "${var.traffic_manager_name}"
        ttl           = 60
    }

    monitor_config {
        protocol = "https"
        port     = 443
        path     = "/health"
    }

    tags = "${merge(
        local.common_tags,
        map("objectname", "${var.traffic_manager_name}")
    )}"
}

# ***** Traffic Manager Endpoints *****
resource "azurerm_traffic_manager_endpoint" "east" {
    name                = "${var.east_endpoint_target}"
    resource_group_name = "${data.azurerm_resource_group.rg.name}"
    profile_name        = "${azurerm_traffic_manager_profile.tm.name}"

    target              = "${var.east_endpoint_target}"
    type                = "externalEndpoints"
    endpoint_status     = "${var.enable_east_endpoint ? "Enabled" : "Disabled"}"
    weight              = "${var.east_endpoint_weight}"
}

resource "azurerm_traffic_manager_endpoint" "west" {
    # Some environments won't need a WestUS region. Therefore, no need to have an endpoint pointing there.
    count               = "${var.provision_west_endpoint ? 1 : 0}"

    name                = "${var.west_endpoint_target}"
    resource_group_name = "${data.azurerm_resource_group.rg.name}"
    profile_name        = "${azurerm_traffic_manager_profile.tm.name}"

    target              = "${var.west_endpoint_target}"
    type                = "externalEndpoints"
    endpoint_status     = "${var.enable_west_endpoint ? "Enabled" : "Disabled"}"
    weight              = "${var.west_endpoint_weight}"
}
@mariobede
Copy link
Contributor

We are in the same situation here. When recreating the azure traffic manager because of changing the monitoring port we get our existing endpoints removed.

Running another plan makes terraform notice there are missing endpoints and they get added.

Running version 0.10.0
Azurerm 0.1.2

Might be related to this specific function not gathering endpoint configs?

https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/azurerm/resource_arm_traffic_manager_profile.go#L216

@tombuildsstuff tombuildsstuff added this to the 1.1.4 milestone Feb 28, 2018
@tombuildsstuff tombuildsstuff self-assigned this Feb 28, 2018
@achandmsft achandmsft added the bug label Mar 10, 2018
@tombuildsstuff tombuildsstuff modified the milestones: 1.3.0, 1.3.1 Mar 15, 2018
@tombuildsstuff tombuildsstuff modified the milestones: 1.3.1, 1.3.2, Future Mar 28, 2018
@ghost
Copy link

ghost commented Apr 18, 2018

Are there any plans to fix this asap? If I tag traffic manager profile, and the tag changed, the endpoint resources are still orphaned

@maetthu
Copy link
Contributor

maetthu commented May 30, 2018

I agree that this is quite serious. It seems that the only way to change a traffic manager profile is to completely remove it first and then rebuild it from scratch. Just changing it removes the endpoints from the profile.

@vladkosarev
Copy link

Same here. Endpoints get created the first time and then removed on any consecutive run even if there is no change to traffic manager. This is obviously pretty bad and takes down everything behind TM.

@tombuildsstuff tombuildsstuff modified the milestones: Future, Being Sorted Oct 25, 2018
@tombuildsstuff tombuildsstuff added the upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc) label Oct 25, 2018
@tombuildsstuff tombuildsstuff modified the milestones: Being Sorted, Blocked Oct 25, 2018
@tombuildsstuff
Copy link
Contributor

👋 hi all

Taking a look into this this appears to be an issue in Terraform Core which has previously been requested in this repository in #326. Rather than having multiple issues open tracking the same thing I'm going to close this issue in favour of that one; however in either case this needs to be fixed in Terraform Core (as such it may get moved again, but I figure it's easier to track this in a single issue).

Thanks!

@tombuildsstuff tombuildsstuff removed this from the Blocked milestone Oct 25, 2018
@ghost
Copy link

ghost commented Mar 6, 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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug service/traffic-manager upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc)
Projects
None yet
Development

No branches or pull requests

7 participants