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

windows_web_app_(slot)_resource: Fix currentStack is not fetched from state when updating infrastructure using terraform. #17490

Merged
merged 2 commits into from
Jul 8, 2022

Conversation

KangDroid
Copy link
Contributor

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 or terraform 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.

image

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 in internal/services/appservice/windows_web_app_resource.go : func update is always set to empty string if site_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

  • Get state's configuration
  • if state contains ApplicationStack, set currentStack to previously-saved state's value.
  • Otherwise, leave it empty string.

Confirmation

  • With provider's version 3.12.0 I've confirmed issue I mentioned above still exists.
  • With custom-built version, where my commits are applied, I've confirmed there is no 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 👍

KangDroid added 2 commits July 4, 2022 22:17
…file when updating infrastructure.

Fix currentStack always resets to empty string when updating infrastructure without changing 'site_config'
…tate file when updating infrastructure.

Fix currentStack always resets to empty string when updating infrastructure without changing 'site_config'
@KangDroid KangDroid changed the title windows_web_app_(slot)_resource: Fix currentStack is not fetch from state when updating infrastructure using terraform. windows_web_app_(slot)_resource: Fix currentStack is not fetched from state when updating infrastructure using terraform. Jul 4, 2022
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @KangDroid ! LGTM 💯

@katbyte katbyte merged commit 675c152 into hashicorp:main Jul 8, 2022
@github-actions github-actions bot added this to the v3.14.0 milestone Jul 8, 2022
@github-actions
Copy link

This functionality has been released in v3.14.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants