terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

[azurerm_linux_function_app] appsetting AzureWebJobsStorage will not stick

Open eltimmo opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

I'm creating a linux function app that's using VNET integration and a storage share. This all works as expected, I also need to set AzureWebJobsStorage to the storage connection string as I think this is used for functions with a Timer trigger. When I apply this everything works, but on subsequent applies terraform always want to set AzureWebJobsStorage.

image
  • Please vote on this issue by adding a :thumbsup: 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 Version

1.2.3

AzureRM Provider Version

3.11.0

Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Terraform Configuration Files

terraform {
  required_version = "1.2.3"
  required_providers {
    azurerm = {
      version = "3.11.0"
      source  = "hashicorp/azurerm"
    }
  }    
}

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "linuxfunctionappsa42"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Linux"
  sku_name            = "Y1"
}

resource "azurerm_linux_function_app" "example" {
  name                = "example-linux-function-app-42"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  storage_account_name = azurerm_storage_account.example.name
  service_plan_id      = azurerm_service_plan.example.id
  app_settings         = {
      AzureWebJobsStorage = azurerm_storage_account.example.primary_connection_string
  }

  site_config {

  }
}

Debug Output/Panic Output

n/a

Expected Behaviour

This should only apply once or be updated if changed by other means outside of terraform

Actual Behaviour

AzureWebJobsStorage is always showing changed when it hasn't been

Steps to Reproduce

terraform apply terraform apply

Important Factoids

No response

References

No response

eltimmo avatar Jun 30 '22 08:06 eltimmo

Thanks @eltimmo , from my perspective, the property is not set back to the state, I'll have a further investigation and try the fix if the investigation result shows it a TF bug.

xiaxyi avatar Jul 02 '22 01:07 xiaxyi

Thanks @eltimmo for raising this issue. the storage account related properties are exposed to below properties in root schema.TF provider will handle the app setting by checking these values. can you try specifying them and see if issue can be resolved?

storage_account_name
storage_account_access_key
storage_key_vault_secret_id

xiaxyi avatar Sep 23 '22 03:09 xiaxyi

Hi @eltimmo , good day. just would like to follow up with you to see if you tried to use the storage related properties mentioned in my last comment?

xiaxyi avatar Jan 09 '23 06:01 xiaxyi

Hi @xiaxyi, I've just re-tested this on 3.37 just using the storage_account_name and storage_account_access_key properties and removing AzureWebJobsStorage and the provider is working as expected.

I've used storage_key_vault_secret_id in another deployment, I can confirm that is working as expected using a reference for the storage connection string.

Thanks for looking at this.

eltimmo avatar Jan 09 '23 14:01 eltimmo

Thanks @eltimmo for the clarification, glad to see it works out! For us to better manage the GH issue list, would you mind closing this issue? Feel free to let me know if you have any other question that I can help to address. :)

xiaxyi avatar Jan 10 '23 01:01 xiaxyi

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Feb 10 '23 02:02 github-actions[bot]