Open shetlinchu opened 2 years ago
It happens to me to. In my case with the component azurerm_linux_web_app
It keeps adding the environment variables. See an extract of the terraform plan
output:
+ "WEBSITE_HTTPLOGGING_RETENTION_DAYS" = "90"
+ "WEBSITE_VNET_ROUTE_ALL" = "1"
No matter the resource configuration. I actually have added the properties:
resource "azurerm_linux_web_app" "this" {
...
http_logs {
file_system {
retention_in_days = 90
retention_in_mb = 100
}
}
...
site_config {
...
vnet_route_all_enabled = true
...
}
app_settings {
...
WEBSITE_HTTPLOGGING_RETENTION_DAYS = 90
WEBSITE_VNET_ROUTE_ALL = 1
...
}
}
But as I said, the plan keeps adding those configuration values every time making a restart of the app service in the process which is a problem, because I cannot deploy any infrastructure change without restarting all the services without the need.
I'm facing the same issue.
And after apply, I see that the changes aren't updated in the portal
This is happening since the time we upgraded from azurerm_app_service to azurerm_windows_web_app. I'm using terraform v1.2.2 & AzureRM provider v3.10.0.
Do you'll have solution for this?
Thanks.
@truptisatardekar As the doc says, the property indicates whether all outbound traffic from the app is routed through the virtual network. A setting value of 1 indicates that all traffic is routed through the virtual network.
Can you confirm if your app meets the behavior?
Also, can you share your TF config with me?
Hello @xiaxyi The app meets the behaviour and everything works fine. The issue here is, these settings have already gone through Terraform Plan + Terraform Apply. However, the next time I run Terraform Plan, it shows up again which from my understanding shouldn't.
Hi, @truptisatardekar , @xiaxyi
I faced exact same issue with "empty current stack settings issue". After some inspection, I've noticed that current_stack settings are always being reset if "site_config" is not changed during other updates.
I made Pull Requests for addressing/fixing this issue. https://github.com/hashicorp/terraform-provider-azurerm/pull/17490
I too am facing this issue where it seems to want to update the WEBSITE_VNET_ROUTE_ALL
setting despite it being correct in TF State/App Service. I know this issues is related to azurerm_windows_web_app
, however I am also seeing this with azurerm_linux_web_app
...
no-op
WEBSITES_ENABLE_APP_SERVICE_STORAGE :
"true"
no-op
WEBSITE_CONTENTOVERVNET :
"1"
no-op
WEBSITE_DNS_SERVER :
"168.63.129.16"
no-op
WEBSITE_ENABLE_SYNC_UPDATE_SITE :
"1"
no-op
WEBSITE_RUN_FROM_PACKAGE :
"1"
create
WEBSITE_VNET_ROUTE_ALL :
"1"
@KangDroid @truptisatardekar Thanks for the fix! Unfortunately, we're still seeing this "empty current stack settings issue" with v3.14 :/ I just deployed a change where we modified app_settings and site_config.scm_minimum_tls_version, this change also cleared the current stack.
Here's the plan that I applied:
After applying the above, current_stack for both the app service and the slot were cleared. See second apply:
@KangDroid @truptisatardekar Thanks for the fix! Unfortunately, we're still seeing this "empty current stack settings issue" with v3.14 :/ I just deployed a change where we modified app_settings and site_config.scm_minimum_tls_version, this change also cleared the current stack.
Here's the plan that I applied:
After applying the above, current_stack for both the app service and the slot were cleared. See second apply:
Hi, I applied another patch after I submit PR, but I literally forgot to add another PR since busy things are on-going on my work;
Basically what I found was : if sites configuration changes, it also resets site-config.
I will submit PR to this repo probably today(if time permits though) but if you are in hurry, can you try cherry-pick this commit to your own provider and see if fully resolved site-config issue?
@KangDroid no worries, this is not an urgent issue (for us at least). As far as I can tell the app service still works with the current_stack property missing, and reapplying the same configuration adds the property back in.
Same here
Same here
I have the same issue with azurerm_linux_web_app
resource:
resource "azurerm_linux_web_app" "this" {
# ... other resource configuration ...
logs {
http_logs {
file_system {
retention_in_days = 30
retention_in_mb = 35
}
}
detailed_error_messages = true
failed_request_tracing = true
}
}
The configuration for retention_in_days
keeps updating even if the value is not changed
~ logs {
# (2 unchanged attributes hidden)
~ http_logs {
~ file_system {
~ retention_in_days = 0 -> 30
# (1 unchanged attribute hidden)
}
}
}
Hi @SebastianBalle
Make sure you don't have WEBSEITE_HTTPLOGGING_RETENTION_DAYS at configuration section
Hi @SebastianBalle
Make sure you don't have
WEBSEITE_HTTPLOGGING_RETENTION_DAYS
at configuration section
@jincod
The environment variable WEBSITE_HTTPLOGGING_RETENTION_DAYS
is not present in my configuration section. I also explored the scm site for the App Service, but I couldn't find any indication that WEBSITE_HTTPLOGGING_RETENTION_DAYS
was specified.
I would expect the retention_in_days
configuration to determine the value of WEBSITE_HTTPLOGGING_RETENTION_DAYS
.
@SebastianBalle please check the terraform.tfstate as well.
My guess based on https://github.com/hashicorp/terraform-provider-azurerm/blob/155958d2cb0845d598dc78367ca6393fd9ff3cac/internal/services/web/app_service_resource.go#L735
@jincod The state file also does not contain any information around the WEBSITE_HTTPLOGGING_RETENTION_DAYS
value. I see that the retention_in_days
is incorrectly specified to 0 so it seems like the configuration is not correctly updated in the state file.
We are also facing the same issue for Linux Appservice without any changes and showing everytime on the plan and causing the application to restart,
I have updated to latest TF Version : 1.4.6 and latest RM Provider : 3.58.0 still facing the same issue.
Just to add to @silambarasan , we are having the same problem with the windows_web_app:
we are seeing this for the virtual application settings. The settings are already applied and the path mapping exists, but terraform plans to apply the settings every time.
@stephybun I've put some detail description about the second problem in this ticket. Basically the Issue is pretty serious because it makes the azurerm_linux_webapp resource pretty much unusable in production. I also expect this issue to exist in other scenarios too so it might worth it to check also for other occurrence.
The issue with the "WEBSITE_HTTPLOGGING_RETENTION_DAYS" variable and the "retention_in_days" setting is:
however, setting "retention_in_days" is the way to do and of course also present in the state On Azure itself, it does not matter if you add/set the environment variable or the explicit setting, if you change one of them, it alters the other automatically.
In our case it causes the following:
Here we have the problem, the JSON which is PUT'ed to the Azure API contains all the environment variables but not the "WEBSITE_HTTPLOGGING_RETENTION_DAYS" because it is not allowed to set
and deleted as suggested bythis post(edit: this post is referencing to a wrong and deprecated resource) Furthermore, the "retention_in_days" is not part of the resource/api endpoint terraform currenty PUTs a request to, there must be another request containing that setting to/config/logs which does not happen here. also there is no second PUT with a json to set the "retention_in_days" correctly because while terraform plan, the setting was set correctly and therefore terraform apply does not know about that change just made by himself.
on the next run, terraform plan detects the missing "retention_in_days" setting and updates it, which is what you actually see as the unwanted change.
Since this issue is related to another resource, i've created a ticket specifically for the log_retention bug:
It also happens for me in azurerm_linux_web_app app_settings for any multiline env var I set. nothing is changed but this always detects a change.
eg:
NGINX_CONF = file("${path.module}/nginx.conf")
or
NGINX_CONF =<<EOF
xyz
EOF
Is there an existing issue for this?
Community Note
Terraform Version
1.1.7
AzureRM Provider Version
3.0.2
Affected Resource(s)/Data Source(s)
azurerm_windows_web_app
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Terraform plan should not have detected changes in the azurerm_windows_web_app because the configuration file is not changed at all.
Actual Behaviour
Terraform plan always detects and applies the same changes for the azurerm_windows_web_app in every TF Plan and TF Apply execution although the configuration for azurerm_windows_web_app has not been changed at all.
Steps to Reproduce
Important Factoids
No response
References
No response