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

Documentation: azurerm_subnet #2786

Closed
OffColour opened this issue Jan 28, 2019 · 4 comments
Closed

Documentation: azurerm_subnet #2786

OffColour opened this issue Jan 28, 2019 · 4 comments

Comments

@OffColour
Copy link

OffColour commented Jan 28, 2019

Documentation on this is a little confusing as it says NSGs need to be configured "both using" and then says "and/or".
Terraform reports the association is deprecated and to use the new resource, but if I remove the association and only use the new resource the NSG doesn't get applied to the subnet.

"NOTE: At this time Subnet <-> Network Security Group associations need to be configured both using this field (which is now Deprecated) and/or using the azurerm_subnet_network_security_group_association resource. This field field is deprecated and will be removed in favour of that resource in the next major version (2.0) of the AzureRM Provider."

Update:
First Apply with Terraform after removing the association in the subnet resource removes the NSG from the subnet.
Applying again reinstates them with the association resource.
Running a third time removes them all again as the subnet resource assocation is not there.

I presume this means that both need to be there and we remove the entry from the subnet resource when v 2.0 comes out.

@tombuildsstuff
Copy link
Contributor

hey @OffColour

Thanks for opening this issue :)

At this point in time both the field within the azurerm_subnet resource and the separate resource azurerm_subnet_network_security_group_association need to be specified; however as you've mentioned we'll be changing this in 2.0 by removing the network_security_group_id field within the azurerm_subnet resource, such that only the azurerm_subnet_network_security_group_association resource will be necessary.

Whilst we're aware this isn't ideal from a UX perspective - unfortunately this is necessary to ensure we don't break a use-case where removing the network_security_group_id field from the Terraform Config for a Subnet removes the attached Network Security Group.

I presume this means that both need to be there and we remove the entry from the subnet resource when v 2.0 comes out.

Indeed - setting this in both locations (using the network_security_group_id field within the azurerm_subnet resource) and via the azurerm_subnet_network_security_group_association resource will ensure this is configured in 1.x. When 2.0 comes out you should be able to remove the network_security_group_id field from the azurerm_subnet resource and work as before; technically speaking you don't need the azurerm_subnet_network_security_group_association resource in 1.x - it's mostly useful at this point in time as a migration (so that you can just drop the field).

As mentioned above - we're aware this isn't an ideal UX in 1.x but this is something we'll be fixing in 2.0 - as such I'm going to close this issue for the moment, that said feel free to let us know if setting this in both places doesn't work for you and we'll take another look.

Thanks!

@OffColour
Copy link
Author

Thanks, @tombuildsstuff .
One minor request in the interim: Can you change the wording on the page so it clearly says "and" rather than "and/or". Should stop anyone else being as confused as I was!

@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Jan 29, 2019

@OffColour sorry forgot to mention that - I've updated that as a part of #2789 which will be released when v1.22 goes out, thanks for the heads up!

@ghost
Copy link

ghost commented Mar 5, 2019

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants