-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Optional Azure FunctionApp settings get overwritten when they don't exist in the TF file #5112
Comments
Hello, is there any progress on this issue? We are running into this exact issue where our pipeline is deploying application settings in our dev environment that regularly change. When we deploy TF it wipes out any deployed application settings. With an ARM template we can create and maintain a function app without having to include application settings and it preserves the existing ones. Please add the ability to allow existing application settings to remain. |
@Altern1ty I gave up on this and found a workaround. Its a pain because I also now have to maintain every Function App with these settings AND a list of variables in my release/deployment pipelines, but hey-ho - these DevOps processes are a massive hackathon anyway! resource "azurerm_function_app" "go-1" { |
personally i prefer that terraform works the way it does, and doesn't ignore settings it sees but doesn't know about. Suppose it did change to what you suggest and just ignores those...now i have a deployment somewhere that presumably does what i want beacuse theres some settings "XYZ" there that tf doesn't know about. I take my TF module/script and apply it to my new environment (like prod)...now i have something that i THINK is the same, but is actually missing "XYZ" setting. That's some implicit magic that i don't want. I want TF to tell me hey there's this thing out there that you didn't define in your tf...but it's there and it needs to be dealt with. i much prefer the explicit. I could see this explicit vs implicit concept being configurable per a resource or even a block , but that would take a lot of code to make work. you've found the way to take an explicit block (app_settings) and make parts of it implicit through the lifecycle ignore_hanges What sucks is that i've seen some tf be implicit and some be explicit and it's not like it's clearly defined anywhere. Somewhere it should say defining one explicit site_config means you must explicitly define all site_config, but in practice a few terraform plans make it pretty clear pretty quick. |
@drdamour "azurerm_function_app" doesn't work in the same manner as "azurerm_app_service" does, and this is the main issue for me, no consistency. "azurerm_app_service" works better and this is also how the "azurerm_function_app" function should work, i.e. don't overwrite app settings if they haven't been explicitly defined by Terraform |
@mcalnd70 pretty sure you are mistaken. If i go in the portal and add a setting then run a tf plan i see that setting i just added that tf file doesnt know about being shown as will be deleted. The behaviour is consistent across the two types |
I can confirm that bug for Terraform v0.12.28. |
I've since found a solution to this issue, you can add an ignore block to the lifecycle to ignore any settings you want terraform not to control. So simply add:
|
@sonic1981 see post from 10th March Its a workaround but not ideal as you have constantly come back to the Terraform if a new parm is created in the FA you are deploying code to. You don't have to do this with WebApps, just FunctionApps |
i'm wondering if this is "fixed" by #8682 |
Hi - by stepping up to Azure provider 2.51.0 this is no longer an issue |
Since this issue seems to have been addressed in the latest versions of the provider (or a valid workaround was provided) - I'm going to close it. Please open a new updated bug report if this is still relevant. Thank you. |
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. |
This issue was originally opened by @mcalnd70 as hashicorp/terraform#23603. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
Debug Output
Extract from the first PLAN output, it makes no mention of app_settings to be set
Crash Output
Expected Behavior
If the app_settings are not specified in the main TF file, then Terraform shouldn't have an opinion on setting them either way (in my view)
The main.tf file does not specify the app_settings, these are indicated by the TF documentation as "optional". Therefore I set them during the actual FunctionApp app code deployment steps outside of Terraform
When the original PLAN runs for Terraform to provision the Function App, it makes no reference in the plan/apply output to anything relating to "app_settings"
Actual Behavior
After the FA code deployment package has been uploaded outside of Terraform, and has set some app_settings, re-running the TF PLAN reports the following app_settings are now going to be "nulled" out, even though (a) they don't exist in the main.tf and (b) the original plan and apply made no mention or had no interest in settings these.
Steps to Reproduce
Additional Context
Running in Azure DevOps pipelines, but reproducible via Terraform command line
References
The text was updated successfully, but these errors were encountered: