-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[azurerm_windows_function_app] Remove of WEBSITE_NODE_DEFAULT_VERSION
and FUNCTIONS_WORKER_RUNTIME
app setting without mention in plan output
#16681
Comments
Hi @StefanSchoof , I'd like to explain why this issue happened. In the resource code, when provider read the function's @jackofallops How can we fix this issue? I'd like to try a fix but I don't know why we've ignored |
Hi @StefanSchoof - Are you modifying the app outside of Terraform here? The service default for that property is Does that help? |
Thanks @jackofallops for the answer. We were in the process of importing existing resources to manage they in the future via terraform. Removing this setting without mention in the plan brought down our webapp. We did not understand the cause of this because terraform mention no change about the And then I tried to reproduce the issue. I created a new web app with node 14 in the portal and run then an import. After the first apply the The problem for me is fixed and since I now know I should always set But I think this behavior is danger for everyone, who tries to import an existing web app in terraform. |
Hi @jackofallops , thanks for your reply. Since the My reproduce code: provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
resource "azurerm_resource_group" "example" {
name = "zjhe-f16681"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "zjhef16681"
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 = "zjhe-f16681"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
os_type = "Windows"
sku_name = "Y1"
}
resource "azurerm_windows_function_app" "example" {
name = "zjhef16681"
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
site_config {}
app_settings = {
WEBSITE_NODE_DEFAULT_VERSION = "~14"
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING = azurerm_storage_account.example.primary_connection_string
}
}
output "resgp_id" {
value = azurerm_resource_group.example.id
}
output "storage_account_id" {
value = azurerm_storage_account.example.id
}
output "svc_plan_id" {
value = azurerm_service_plan.example.id
}
output "func_id" {
value = azurerm_windows_function_app.example.id
} I've applied the code, then I copied the tf code to a new folder, import all resources one by one. Then I tried to export If we use Terraform to manage the function app, it will delete |
Hi @lonegunmanb - The intended way to manage that setting is via the The gap here is one of documentation, specifically calling out explicitly that the @StefanSchoof - Thanks for the understanding, and apologies for the confusion. I'll take a look at adding a section to the docs on the import process to help clarify this for other users that may hit the same issue! I'll leave this issue open for now, and link the docs PR back to it when we open that. Thanks again! |
I think having a |
@jackofallops I'd like to help on this issue, would you please give me some instructions on how to improve the document so I can try a pr? Thanks! |
I have set |
Similar thing happens on |
Is there an existing issue for this?
Community Note
Terraform Version
1.1.9
AzureRM Provider Version
3.5.0
Affected Resource(s)/Data Source(s)
azurerm_windows_function_app
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
terraform shows the change of the
WEBSITE_NODE_DEFAULT_VERSION
andFUNCTIONS_WORKER_RUNTIME
of the app settings in the plan outputActual Behaviour
terraform shows no change to
WEBSITE_NODE_DEFAULT_VERSION
andFUNCTIONS_WORKER_RUNTIME
but removes them.
before
after
(the right fix is adding a
)
But I think terraform should never change anthing that is not visable in the plan.
Steps to Reproduce
terraform import azurerm_windows_function_app.example /subscriptions/dd47ff80-9de3-45ec-a16d-75f3599d9f8b/resourcegroups/node_version_test/providers/Microsoft.Web/sites/nodeversiontest
Important Factoids
No response
References
#16196
#16650
The text was updated successfully, but these errors were encountered: