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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources created by azurerm_resource_group_template_deployment are not detecting differences #11414

Open
ajklotz opened this issue Apr 21, 2021 · 0 comments

Comments

@ajklotz
Copy link

ajklotz commented Apr 21, 2021

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.14.7
+ provider registry.terraform.io/hashicorp/azurerm v2.44.0

Affected Resource(s)

  • azurerm_resource_group_template_deployment
    In this scenario, it is "type": "Microsoft.Web/sites/config" and "type": "Microsoft.Web/sites/slots/config"

Terraform Configuration Files

resource "azurerm_resource_group_template_deployment" "api_virtual_directory" {
  name                = "api_virtual_directory"
  resource_group_name = azurerm_resource_group.digital.name
  deployment_mode     = "Incremental"
  template_content    = <<TEMPLATE
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "webAppName": {
        "type": "String",
        "defaultValue": "${module.webapp["api"].name}"
    },
    "virtualApplications":{
      "type": "Array",
      "defaultValue":[
        {
        "virtualPath": "/",
        "physicalPath": "site\\wwwroot",
        "preloadEnabled": false,
        "virtualDirectories": null
        },
        {
        "virtualPath": "/app1",
        "physicalPath": "site\\wwwroot\\app1",
        "preloadEnabled": false,
        "virtualDirectories": null
        },
        {
        "virtualPath": "/app2",
        "physicalPath": "site\\wwwroot\\app2",
        "preloadEnabled": false,
        "virtualDirectories": null
        }
      ]
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/sites/config",
      "name": "[concat(parameters('webAppName'), '/web')]",
      "apiVersion": "2020-06-01",
      "properties": {
          "virtualApplications": "[parameters('virtualApplications')]"
      }
    }
  ]
}
TEMPLATE
  depends_on          = [module.webapp["api"]]
}

Debug Output

Panic Output

Expected Behaviour

Terraform should detect that the site config has drifted, and should apply those virtual directories

Actual Behaviour

Virtual directories are not created for the web app

Steps to Reproduce

  1. Have terraform configuration create web app and the virtual directories.
  2. Delete the web app from Azure Portal
  3. Rerun the terraform apply
  4. Terraform creates the web app again, but does not create virtual directories

Important Factoids

References

  • #0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants