-
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_web_app - cors in site_config is removed #19323
Comments
@peterprumbach-telekom , Thanks for raising this issue, the fix was merged, can you confirm if it's working from your side? |
@xiaxyi what pr merged a fix? |
@drdamour Sorry I misunderstood your last comments. Are you suggesting that you are not able to upgrade the provider to the version that have the fix deployed? |
In which version the fix was deployed? |
@drdamour Can you be more specific about the issue you are facing? would be better if you can share the detailed diff here. @peterprumbach-telekom 3.31.0 provider. |
@xiaxyi the diff was provided in the original post by @peterprumbach-telekom did you read through it its quite clear the problem. if you omit the cors block every plan shows setting the values to null. Apply does not change this subsequent plan shows same change again and again 3.31 introduced this problem. Im pinning to 3.30 to avoid it |
@drdamour , I see, this may due to the default value sets by the api.... let me check how to deal with it. |
@peterprumbach-telekom , if user doesn't specify cors setting in TF config, the api will return The diff you are getting somehow suggests that there was a cors setting either made from TF or from anywhere else outside TF (maybe the portal... ), I need your help to confirm how did you get the cors set. Thanks! |
i don't think so, we don't even have access to change things in the portal, everything goes through terraform. i don't know what version of azurerm would have created it. it seems like it shouldn't matter though, if cors isn't set in tf it should either leave it be or set it to the defaults so subsequent applies don't show it changing each time. in resource explorer i'm seeing cors: null at the website level (providers/Microsoft.Web/sites//) but NOT NULL at providers/Microsoft.Web/sites//config so double check what api your testing with. |
We have not added cors, neither via Terraform nor via the Azure Portal. Since version 3.31.0, this change appears in every windows_web_app and linux_web_app.
The same is true for us. The changes are always displayed in Terraform - even with subsequent applies |
Thanks @peterprumbach-telekom and @drdamour for the discussion. I'm using 2021-02-01 for the testing. I'm not sure about any changes from the api side, but when I tested the feature today by using TF confg:
I got the cors sets to null from the api... let me have more tests, meanwhile, is it possible to help me to confirm this by creating a new web app? |
As requested in #19473 , I think I know how this can happen:
Suspected reason:
instead of
as it is on the other web apps. That state will also not be set to [] but will always stay like this after a terraform apply. The state is stored in an azure storage account. I tried manually changing the tfstate file to say |
Thanks @derSchtefan for the detailed information. I did more test and I suspect what's happening here is the setting: cors = null won't override the setting
which means, once you have the cors set, no matter what the value is, you won't be able to get the status:
|
This is where my experience differs, since I do get Using The only place that has |
@derSchtefan azure api for /siteName has retuned null for most props for a long time and it sucks. U have to use /siteName/config to see the real values |
@derSchtefan and i bet this calls /config..most the other things in azurerm do. Either way tf is bugged here and this needs the bug label badly |
@xiaxyi i suggest stop trying to minimize this problem to some sub case. Refresh is finding cors props being set it’s irrelevant how they are set. Azurerm should see those and leave them or change them..what it cant do is the current behaviour of saying its gonna change them And then NOT change them on apply. So for your test just set the value and experience the problem. In your fix to #19078 u moved the logic outside the if block which is why this is happening now. That was probably there to avoid this situation, but lead to the problems #19078 was trying to fix. im not sure what azurerm should do..have defaults matching azure defaults or avoid making a change when cors is omitted. Both have drawbacks but the current behavior sucks. |
@drdamour , yes, I will add the condition set. |
@drdamour I can confirm this is the case indeed. |
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. |
Is there an existing issue for this?
Community Note
Terraform Version
1.3.4
AzureRM Provider Version
3.31.0
Affected Resource(s)/Data Source(s)
azurerm_windows_web_app
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The block "cors" should not be displayed as a change, as no changes were made here
Actual Behaviour
Since the block "cors" has not been defined, there should be no change here. The "cors" block is listed as optional in the documentation
Steps to Reproduce
No response
Important Factoids
Azure GermanyWestCentral
References
No response
The text was updated successfully, but these errors were encountered: