Skip to content
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_linux_web_app, azurerm_linux_web_app_slot - fix docker setting not being saved to application setting issue #24086

Closed
wants to merge 1 commit into from

Conversation

xiaxyi
Copy link
Contributor

@xiaxyi xiaxyi commented Dec 1, 2023

The same issue as the previous PR:#22484

As already mentioned in that pr, there are two api to set the application setting:

  1. AppSetting inside the siteConfig - this setting is updated by api PUT "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web"
  2. The other one is to update the app setting directly by calling:
    POST "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsetting

In current provider, we only update the app setting via #1 which takes no effect to the app setting block. We need to update the docker setting using #2.

fix #24046
fix #23632
fix #23525
fix #22379

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xiaxyi - Thanks for this PR, I think this might need a broader fix to avoid other potential similar problems, suggestion below if you can take a look?

Thanks!

Comment on lines +405 to +420
if siteConfigAppSetting := siteConfig.AppSettings; siteConfigAppSetting != nil && len(*siteConfigAppSetting) > 0 {
if webApp.AppSettings == nil {
webApp.AppSettings = make(map[string]string)
}
for _, pair := range *siteConfigAppSetting {
if pair.Name == nil || pair.Value == nil {
continue
}
if *pair.Name == "DOCKER_REGISTRY_SERVER_URL" ||
*pair.Name == "DOCKER_REGISTRY_SERVER_USERNAME" ||
*pair.Name == "DOCKER_REGISTRY_SERVER_PASSWORD" {
webApp.AppSettings[*pair.Name] = *pair.Value
}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this only address part of a larger problem here? Other evaluated settings may also be dropped from the map? I suspect what we should do here is extend the func ExpandAppSettingsForUpdate to take both maps and combine them to ensure everything is caught?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any KVP that are updated via the siteConfig api needs to be updated using the APPSETTING dedicated POST API(https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/list-application-settings?view=rest-appservice-2022-03-01). I only updated the docker one to follow one issue in one PR.

You are correct about extending the ExpandAppSettingsForUpdate to merge the KVPs

@xiaxyi
Copy link
Contributor Author

xiaxyi commented Dec 13, 2023

updated as the comment

@jackofallops
Copy link
Member

As discussed offline with @xiaxyi - closing in favour of 24221

Copy link

github-actions bot commented May 3, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.