-
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
conflict between azurerm_subnet_route_table_association and azurerm_subnet route_table_id #2358
Comments
hey @steve-hawkins Thanks for opening this issue :) Until the 2.0 release of the AzureRM Provider unfortunately both the For the moment that means we've documented this behaviour on the documentation for this resource - but I'm not sure if there's anything else we could do prior to 2.0 without introducing a breaking change? Thanks! |
hey @steve-hawkins As a workaround I use a lifecycle in azurerm_subnet :
I don't know if this is the best way, but I have not seen any problem with this workaround yet. Hope it will help you. Jérémy. |
thank @tombuildsstuff I agree with the approach and the note in the documentation makes sense. I raised this issue mostly because of the misleading warning regarding deprecated "route_table_id" from the plan output, would it make sense to update the wording of this warning to deprecating "route_table_id" from 2.x? @jmapro thanks for the workaround, that does the job |
@tombuildsstuff , if i were to do it the way you suggested, it prompts me with an error:
If I comment ( See my example;
|
Thanks a lot @jmapro it works for me! It would be nice to have an "official" confirmation that this solution doesn't introduce any other problem. This could be use also to solve the "network_security_group_id" versus "azurerm_subnet_network_security_group_association" problem until AzureRM version 2 is published. |
👋 For the moment this needs to be configured in both places, e.g. resource "azurerm_resource_group" "test" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_virtual_network" "test" {
name = "example-network"
address_space = ["10.0.0.0/16"]
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
resource "azurerm_route_table" "test" {
name = "example-routetable"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
route {
name = "example"
address_prefix = "10.100.0.0/14"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.10.1.1"
}
}
resource "azurerm_subnet" "test" {
name = "frontend"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_network_name = "${azurerm_virtual_network.test.name}"
address_prefix = "10.0.2.0/24"
route_table_id = "${azurerm_route_table.test.id}"
}
resource "azurerm_subnet_route_table_association" "test" {
subnet_id = "${azurerm_subnet.test.id}"
route_table_id = "${azurerm_route_table.test.id}"
} As mentioned above once 2.0 it out you should be able to drop the Since there doesn't appear to be anything remaining in this task until 2.0 - I'm going to close this issue for the moment. Thanks! |
This has been released in version 1.29.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 = "~> 1.29.0"
}
# ... other configuration ... |
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! |
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
No warnings to appear
Actual Behavior
A warning appears
Steps to Reproduce
terraform init
terraform plan
terraform apply
terraform plan
Important Factoids
I have taken the Terraform config above straight from the documentation, if you remove the deprecated route_table_id from the azurerm_subnet resource then you get the following plan after running step 4. in the reproduction steps above:-
References
azurerm_subnet_network_security_group_association
/azurerm_subnet_route_table_association
#1933The text was updated successfully, but these errors were encountered: