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

[AVM Module Issue]: Add the possibility of associating routing tables managed outside this module #166

Open
1 task done
But4ler opened this issue Nov 5, 2024 · 3 comments
Assignees
Labels
Language: Terraform 🌐 This is related to the Terraform IaC language Status: Long Term ⏳ We will do it, but will take a longer amount of time due to complexity/priorities Type: Feature Request ➕ New feature or request

Comments

@But4ler
Copy link

But4ler commented Nov 5, 2024

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Feature Request

(Optional) Module Version

No response

(Optional) Correlation Id

No response

Description

Hello
Currently:

  • We create the subnets via this module
  • We use the module "Azure/avm-res-network-routetable/azurerm" to create a lot of our route tables and associate them with the subnets

The problem:

  • During the first tf apply, the route table module associates with the subnet, and the tf apply is OK
  • During the second tf apply, the vnet module tries to remove the association with the route table subnet
  • During the third tf apply, the udr module tries to create the association with the route table subnet

Would it be possible to add one option for ignore the associations of subnets and route tables on this module ?

$ terraform apply
Terraform detected the following changes made outside of Terraform since the last "terraform apply" which may have affected this plan:

  # module.udr_onprem_to_spokes.azurerm_route_table.this has changed
  ~ resource "azurerm_route_table" "this" {
        id                            = "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/routeTables/udr_onprem_to_spokes-npr-frc-01"
        name                          = "udr_onprem_to_spokes-npr-frc-01"
      ~ subnets                       = [
          - "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/virtualNetworks/vnet-intranettransit-npr-frc-01/subnets/GatewaySubnet",
          - "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/virtualNetworks/vnet-intranettransit-npr-frc-01/subnets/snet-intratz-agw-npr-frc-01",
          - "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/virtualNetworks/vnet-intranettransit-npr-frc-01/subnets/snet-intratz-agw-npr-frc-02",
        ]
        tags                          = {}
        # (5 unchanged attributes hidden)
    }

Thanks


Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.vnet.module.subnet["agw-01"].azapi_resource.subnet will be updated in-place
  ~ resource "azapi_resource" "subnet" {
      ~ body                      = {
          ~ properties = {
              ~ routeTable                        = null -> {
                  + id = "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/routeTables/udr_onprem_to_spokes-npr-frc-01"
                }
                # (11 unchanged attributes hidden)
            }
        }
        id                        = "/subscriptions/5c3a7590-dcca-XXXXXXX-16d9ff8f338a/resourceGroups/rg-intranettransit-network-npr-01/providers/Microsoft.Network/virtualNetworks/vnet-intranettransit-npr-frc-01/subnets/snet-intratz-agw-npr-frc-01"
        name                      = "snet-intratz-agw-npr-frc-01"
      ~ output                    = {} -> (known after apply)
        # (7 unchanged attributes hidden)
    }
.....
@But4ler But4ler added Language: Terraform 🌐 This is related to the Terraform IaC language Needs: Triage 🔍 Maintainers need to triage still labels Nov 5, 2024
@jaredfholgate jaredfholgate removed the Needs: Triage 🔍 Maintainers need to triage still label Nov 6, 2024
@jaredfholgate
Copy link
Member

Thank you for raising this. We'll take a look ASAP. Hopefully by next week.

@jaredfholgate jaredfholgate self-assigned this Nov 6, 2024
@jaredfholgate jaredfholgate added the Needs: Attention 👋 Reply has been added to issue, maintainer to review label Nov 6, 2024
@jaredfholgate
Copy link
Member

This is not simple to do since Terraform modules do not support the lifecycle ignore. We'd have to duplicate the resource or use the azapi_update_resource to support this. I'll add the long term label for now and look into as time allows. We are happy to accept and review PR's of course.

@jaredfholgate jaredfholgate added Status: Long Term ⏳ We will do it, but will take a longer amount of time due to complexity/priorities and removed Needs: Attention 👋 Reply has been added to issue, maintainer to review labels Dec 11, 2024
@jaredfholgate
Copy link
Member

I have taken this back to the core team to discuss as we are having more requests similar to this and need to come up with a generic solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language: Terraform 🌐 This is related to the Terraform IaC language Status: Long Term ⏳ We will do it, but will take a longer amount of time due to complexity/priorities Type: Feature Request ➕ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants