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

automation log_analytics_workspace_linked_service forces new resource with no changes #2593

Closed
philbal611 opened this issue Jan 3, 2019 · 3 comments · Fixed by #2594
Closed

Comments

@philbal611
Copy link
Contributor

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

Terraform v0.11.11
provider.azurerm v1.20.0

Affected Resource(s)

  • azurerm_log_analytics_workspace_linked_service

Terraform Configuration Files

data "azurerm_resource_group" "rg" {
  name = "TestRG-EastUS-01"
}

resource "azurerm_automation_account" "auto-account" {
  name                = "Test-Account"
  resource_group_name = "${data.azurerm_resource_group.rg.name}"
  location            = "${data.azurerm_resource_group.rg.location}"

  sku {
    name = "Basic"
  }
}

resource "azurerm_log_analytics_workspace" "law" {
  name                = "Test-Workspace"
  resource_group_name = "${data.azurerm_resource_group.rg.name}"
  location            = "eastus"
  sku                 = "Standard"
}

resource "azurerm_log_analytics_workspace_linked_service" "law-ls" {
  resource_group_name = "${data.azurerm_resource_group.rg.name}"
  workspace_name      = "${azurerm_log_analytics_workspace.law.name}"
  linked_service_name = "automation"

  linked_service_properties {
    resource_id = "${azurerm_automation_account.auto-account.id}"
  }
}

Expected Behavior

After a successful apply, a plan should result in

No changes. Infrastructure is up-to-date.

Actual Behavior

After a successful apply, a plan results in forcing a new resource:

-/+ azurerm_log_analytics_workspace_linked_service.law-ls (new resource required)
      id:                                    "/subscriptions/<sub_id>/resourcegroups/testrg-eastus-01/providers/microsoft.operationalinsights/workspaces/test-workspace/linkedservices/automation" => <computed> (forces new resource)
      linked_service_name:                   "automation" => "automation"
      linked_service_properties.%:           "1" => "1"
      linked_service_properties.resource_id: "/subscriptions/<sub_id>/resourceGroups/TestRG-EastUS-01/providers/Microsoft.Automation/automationAccounts/Test-Account" => "subscriptions/<sub_id>/resourceGroups/TestRG-EastUS-01/providers/Microsoft.Automation/automationAccounts/Test-Account"
      name:                                  "test-workspace/Automation" => <computed>
      resource_group_name:                   "testrg-eastus-01" => "TestRG-EastUS-01"
      tags.%:                                "0" => <computed>
      workspace_name:                        "test-workspace" => "Test-Workspace" (forces new resource)

It seems that the workspace_name attribute gets set to lowercase and triggers a change (forcing new resource in this case).


Any attempt at applying this change results in an error. The automation linked service cannot be destroyed, and thus, the config is stuck:

* azurerm_log_analytics_workspace_linked_service.law-ls (destroy): 1 error(s) occurred:

* azurerm_log_analytics_workspace_linked_service.law-ls: Error issuing AzureRM delete request for Log Analytics Linked Service 'automation': operationalinsights.LinkedServicesClient#Delete: Failure sending request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="Conflict" Message="The link cannot be updated or deleted because it is linked to Update Management and/or ChangeTracking Solutions"

Steps to Reproduce

  1. Successfully deploy

    • azurerm_automation_account
    • azurerm_log_analytics_workspace
    • azurerm_log_analytics_workspace_linked_service
  2. Run terraform plan or terraform apply

References

  • #0000
@katbyte
Copy link
Collaborator

katbyte commented Jan 4, 2019

Hi @philbal611,

Sorry that your having this issue. It seems the API is returning all properties back in lowercase, as such i've opened #2594 that should resolve this 🙂

@katbyte katbyte added this to the 1.21.0 milestone Jan 4, 2019
@philbal611
Copy link
Contributor Author

Great, thanks!!

@ghost
Copy link

ghost commented Mar 5, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

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