windows_web_app_(slot)_resource: Fix currentStack is not fetched from state when updating infrastructure using terraform. #17490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background(Problem)
I had some problem with Azure App Service(Windows) that - every time I apply updates to our Azure infrastructure, 'Stack Settings' always being reset.
After being reset, whenever I type
terraform plan
orterraform apply
those plans shows me that I have to add 'Stack Settings' should be applied again. - Even though I already declared 'Stack Settings' in initial updates.Turns out I had to double-apply all the time whenever I apply updates to Azure infrastructure.
Investigation & Possible Cause
With little golang knowledge and Terraform Azure RM Provider's architecture style, I've found that variable called
currentStack
ininternal/services/appservice/windows_web_app_resource.go : func update
is always set to empty string ifsite_config
is not changed.By this, I came to personal conclusion: 'Whenever app service resource being updated without
site_config
, currentStack always set to empty string and applies to actual Azure App Service.' -> and it really did applied 'empty currentStack' to Azure App Service.Solutions
currentStack
to previously-saved state's value.Confirmation
current_stack
issue with updating resources.Related Issues
Best entrypoint I could find was #16257 , but most relevant thread reply would be #16257 (comment) .
Others
Please let me know if I am doing something wrong. Feedbacks, other suggestions are always welcome!
Thanks 👍