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

oci_core_route_table gets recreated even if there are no changes #2070

Open
carlosmartinezmoller opened this issue Mar 20, 2024 · 0 comments
Labels

Comments

@carlosmartinezmoller
Copy link

carlosmartinezmoller commented Mar 20, 2024

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

Terraform Version and Provider Version

Terraform v1.7.5
on linux_amd64

  • provider registry.terraform.io/oracle/oci v5.32.0

Affected Resource(s)

oci_core_route_table

Issue description

Each time that "terraform apply" is executed the route gets recreated even if there are no changes:
`
Terraform will perform the following actions:

  module.network.oci_core_route_table.route_tables["rt-public"] will be updated in-place
  ~ resource "oci_core_route_table" "route_tables" {
    id             = "ocid1.routetable.oc1.iad.aaaaaaaaz2te5mbglprlwm3xrpoozknl7bwtqmc7gikiejkj25rr3g34tzha"
    # (7 unchanged attributes hidden)

  - route_rules {
      - description       = "Route all the traffic to internet" -> null
      - destination       = "0.0.0.0/0" -> null
      - destination_type  = "CIDR_BLOCK" -> null
      - network_entity_id = "ocid1.internetgateway.oc1.iad.aaaaaaaaw6gyllyb3vyz2pfn2damgok44ypop66fnt5ey5zqf3ae5qmjxdvq" -> null
    }
  + route_rules {
      + cidr_block        = (known after apply)
      + description       = "Route all the traffic to internet"
      + destination       = "0.0.0.0/0"
      + destination_type  = "CIDR_BLOCK"
      + network_entity_id = "ocid1.internetgateway.oc1.iad.aaaaaaaaw6gyllyb3vyz2pfn2damgok44ypop66fnt5ey5zqf3ae5qmjxdvq"
      + route_type        = "STATIC"
    }
}

 Plan: 0 to add, 1 to change, 0 to destroy.

`

The issue is related to the "cidr_block" field which is supposed to be deprecated. I should only be informing "destination" which replaces "cidr_block"

The issue happens even if I define it or I don't.

Terraform Configuration Files

This is how I create my routes:

`
resource "oci_core_route_table" "route_tables" {

    for_each={ for route_table in var.route_tables: route_table.display_name => route_table }

    # Required
    compartment_id=var.network_compartment_id
    vcn_id=oci_core_vcn.vcn.id
    display_name=each.value.display_name

    dynamic "route_rules" {

            for_each = { for route_rule in each.value.route_rules: route_rule.name => route_rule }
            content {
                    destination_type                = route_rules.value.destination_type
                    destination                     = route_rules.value.destination
                    network_entity_id               = route_rules.value.network_entity_id
                    route_type                      = "STATIC"
                    description                     = route_rules.value.description
            }
    }

     }

`

Debug Output

Expected Behavior

In theory the apply action should say that everything is up-to-date and not generate any change.

References

I see a similar issue #1844 but related to the route_type field.

In my case I am not hitting this issue with the route_type field, but with the cidr_block one which is deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant