Last active
July 8, 2021 15:07
-
-
Save spettifer/55dc46bad2f002f1c7def76814ccbd42 to your computer and use it in GitHub Desktop.
Workaround for application insights instances created using Terraform AzureRM provider v1.x when upgrading to v2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The application_type attribute is now case senstive. If the resource has been previously created with provider v1.x and the | |
# application_type was not lower case, then changing it to suit the v2 provider will result in the resource being destroyed | |
# and re-created since there is no way to update this value in place | |
# (see https://github.com/terraform-providers/terraform-provider-azurerm/issues/5902). | |
# To prevent this, add a lifecycle customisation and specify application_type as an attribute to ignore. Any attribute specified | |
# in the ignore_changes array will not be considered when creating a plan for an update, but they will still be part of creating | |
# a new resource. | |
resource "azurerm_application_insights" "appinsights" { | |
name = "${local.prefix}-appname" | |
resource_group_name = azurerm_resource_group.main.name | |
location = azurerm_resource_group.main.location | |
application_type = "web" | |
tags = local.tags | |
lifecycle { | |
ignore_changes = [ | |
application_type | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you very much for this!