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

Fix 8768 corrupt ip_restrictions in App Service and add tests #10843

Closed
wants to merge 9 commits into from

Conversation

sdebruyn
Copy link
Contributor

@sdebruyn sdebruyn commented Mar 4, 2021

The root cause was that IP restriction lines are being reused. When a reused one had a subnet and it would be changed to an IP, then the subnet was not removed. Thus, to know what has changed, I had to pass ResourceData down the tree.

Any kind of feedback is welcome, I don't regularly use Go.

@ghost ghost added the size/L label Mar 4, 2021
@sdebruyn sdebruyn changed the title add acc tests to cover #8768 Add acc tests and fix condition for app_service ip_restriction Mar 4, 2021
The previous value for subnet/IP/tag was not removed when the record was going to be reused for another subnet/IP/tag. Thus we need to know which property changed so that we can determine which one of subnet/IP/tag is the one we have to keep. Passing down the ResourceData to this method is how can we pass diff information down the tree.
@ghost ghost added size/L and removed size/M labels Mar 5, 2021
@sdebruyn sdebruyn changed the title Add acc tests and fix condition for app_service ip_restriction Fix 8768 corrupt ip_restrictions in App Service and add tests Mar 5, 2021
@jackofallops
Copy link
Member

Hi @sdebruyn - I've taken a quick look over this and I think we may be addressing the wrong problem here? It appears that when the subnet_id property was deprecated, it was done so with a bug in there that forced users to also specify virtual_network_subnet_id to use it, which was not the intent as this property was meant to replace it. (this can be seen in the example config in the linked issue). I'm going to do a little more investigation, but I think it can be resolved relatively simply. If that's the case, I will open a new PR to supersede this one (with some more complex test cases), if that's OK with you?

@sdebruyn
Copy link
Contributor Author

Hi @jackofallops, certainly! Whatever gets the issue fixed! It's a real dealbreaker for us.

In my findings the extra subnet property was not the cause of this issue (although it was my first thought too).

I would merge the tests anyway so that this issue can be tracked.

@jackofallops
Copy link
Member

Thanks @sdebruyn - You are correct, there's an issue with the way the flatten and expand functions are working there too... I've got a branch running through the full regression suite at the moment that appears to resolve the initial issue, I'll add some more complex scenarios too for extra confidence. Typically we phase out deprecated properties from tests, but I think in this case it'll be worth having some coverage there. As soon as I'm confident I'll open the PR and close here with references.

@katbyte
Copy link
Collaborator

katbyte commented Apr 15, 2021

I'm going to close this in favour of #11170 - thanks for starting this @sdebruyn

@katbyte katbyte closed this Apr 15, 2021
@katbyte katbyte added this to the v2.56.0 milestone Apr 15, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 2.56.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.56.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 15, 2021

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.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
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.

None yet

4 participants