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

How to switch to association resource due to deprecation of property #4818

Closed
pixelicous opened this issue Nov 6, 2019 · 2 comments · Fixed by #5801
Closed

How to switch to association resource due to deprecation of property #4818

pixelicous opened this issue Nov 6, 2019 · 2 comments · Fixed by #5801

Comments

@pixelicous
Copy link

pixelicous commented Nov 6, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Hi,

I have a module that went out of sync between state and Azure portal.
I have modified the module, aligned it, ran init/plan and started importing already existing resources.

Those resources are basically subnets with route tables and nsgs on them.
i have created association resource objects for both nsg and routing table and imported these as well.

When i execute the plan command, i get a line showing that the "route_table_id" property will change to NULL from the value that it had, for example -

  • route_table_id = "/subscriptions/xxx-xxx-xx/resourceGroups/my-rg/providers/Microsoft.Network/routeTables/my-rt" -> null

I tried modifying the state file manually, basically removing the value of route_table_id for those imported objects to be null, or jut or remove the property all together, the plan executed after that didn't show like there is a difference. Still showed like it is going to be null after the change.

To overcome this i decided to manually change the hcl and add that route_table_id property, maybe terraform will now not try to make a "null" out of it. this just showed like the new proprerty will be added now, and not changed or deleted.

So i removed this change as well.

After running apply once more, the routes and nsg were removed from the attached subnets, not sure why, the association objects are there.

I put back the "route_table_id_property" on the objects, ran apply, now "nothing changed", but i still have both tthe association and the property configured, when tryingt o remove the property terraform shows like it will re-add it.

So how can one remove a depcreated property????

Terraform (and AzureRM Provider) Version

terraform 0.12.9
azurerm 1.36.1

Affected Resource(s)

  • azure_rm_route_table
  • azure_rm_route_table_association
  • azure_rm_subnet
  • azure_rm_security_group
  • azure_rm_security_group_association

Terraform Configuration Files

resource azurerm_subnet internal {
  count                = length(local.internal_subnets["name"])
  name                 = element(local.internal_subnets["name"], count.index)
  virtual_network_name = azurerm_virtual_network.vnet.name
  resource_group_name  = azurerm_resource_group.network.name
  address_prefix       = element(local.internal_subnets["address_prefix"], count.index)


resource azurerm_subnet_route_table_association internal_to_trust {
  count          = length(local.internal_subnets["name"])
  subnet_id      = element(azurerm_subnet.internal.*.id, count.index)
  route_table_id = azurerm_route_table.test_rt.id
}

resource azurerm_route_table test_rt {
  name                   = "my-rt"
  location            = terraform.workspace
  resource_group_name = azurerm_resource_group.network.name

  tags = var.tags
}
}```

### Panic Output

Warning: "network_security_group_id": [DEPRECATED] Use the `azurerm_subnet_network_security_group_association` resource instead
Warning: "route_table_id": [DEPRECATED] Use the `azurerm_subnet_route_table_association` resource instead.
@ghost
Copy link

ghost commented Feb 24, 2020

This has been released in version 2.0.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.0.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 28, 2020

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 and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants