-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Switching default_outbound_access_enabled from true to false for azurerm_subnet forces replacement #27848
Comments
Hi @jcetina Have you tried to reproduce it using the latest azurerm provider? as of today is 4.7.0 |
@Chambras I have not. I'm happy to try it, but also I'm not sure even if it works that it solves my or other Azure customer's problems. Rolling forward a full version from 3->4 is non-trivial at scale. I guess what I'm saying is that if it works in 4, can you backport it to 3? |
@jcetina sadly I do not think hashicorp doesn't backport fixes :( |
According to the FAQs, backporting fixes/changes only happens on exceptional cases. Sorry for the bad news. |
I want to clarify that I truly believe this is an exception case, not just for me, but for any Terraform customer who wants to use this feature. Let me explain. By default, a machine with out a public IP address on an Azure subnet can still access the Internet. You can read about how it all works here. When you set this flag to false, that behavior is disabled for new VMs being attached to the subnet. That's a good thing for security. Azure is actually removing default outbound access for VMs in 2025. Azure customers who consume Terraform want to get ahead of this by disabling outbound access would normally set the flag to false and add any explicit outbound methods to their subnets. Forcing replacement makes accomplishing this change non-viable. You'd have to remove all resources from your subnet, delete and recreate it, and then reprovision those resources. Nobody is going to do that. I can't predict how people will deal with it, but I don't think it will be easy or good for Azure Terraform customers. It's also not good to introduce this much friction for a good security change. So, while this is obviously in my own interest, I think it's reasonable to consider this as an exceptional case. Anyway, thanks for reading to the bottom. I understand reasonable people may disagree. I just wanted to make the argument. Thanks. |
@jcetina you have a very good point and if @CorrenSoft PR gets approved, it might solve your issue. I said it might because you might need to upgrade to the latest version in order to use it. |
Is there an existing issue for this?
Community Note
Terraform Version
1.8.1
AzureRM Provider Version
3.116.0
Affected Resource(s)/Data Source(s)
azurerm_subnet
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The expected behavior is for Terraform to simply update the existing resource without replacement. The Azure rest API allows for modification of this setting without replacement. I will also add that the current behavior of this module makes adopting this setting for existing subnets with large amounts of resources on them extremely challenging.
Actual Behaviour
As seen in the plan, terraform wants to replace the subnet specifically because of the change of
default_outbound_access_enabled
from true to false.Steps to Reproduce
Create a subnet with
default_outbound_access_enabled
set to true, deploy it, and then switch it to false and run a plan.Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered: