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

Importing oci_core_route_table resources does not import attributes in rules #2224

Open
nepeat opened this issue Oct 17, 2024 · 1 comment
Open
Labels

Comments

@nepeat
Copy link

nepeat commented Oct 17, 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

OpenTofu v1.8.2
on darwin_arm64
+ provider registry.opentofu.org/hashicorp/oci v6.13.0

Affected Resource(s)

  • oci_core_route_table

Terraform Configuration Files

resource "oci_core_route_table" "minimal" {
    vcn_id = var.vcn_ocid
    compartment_id = "ocid1.compartment.oc1..id"

    route_rules {
        network_entity_id = "ocid1.servicegateway.oc1.region.id"
        description = "SGW"

        destination = "all-ord-services-in-oracle-services-network"
        destination_type = "SERVICE_CIDR_BLOCK"
        route_type = "STATIC"
    }
}

Debug Output

Debug output not provider due to confidentiality of output.

Panic Output

N/A

Expected Behavior

No differences between imported resource and the Terraform file.

This is expected because the output from retrieving the route table directly contains the route-type and cidr-block. oci network route-table get --rt-id ocid1.routetable.oc1.us-chicago-1.id | jq '.data."route-rules"'

  1. cidr-block should be imported as an explicit null value in the state.
  2. route-type should be imported into the state as it has a value.
[
  {
    "cidr-block": null,
    "description": null,
    "destination": "all-ord-services-in-oracle-services-network",
    "destination-type": "SERVICE_CIDR_BLOCK",
    "network-entity-id": "ocid1.servicegateway.oc1.us-chicago-1.id",
    "route-type": "STATIC"
  }
]

Actual Behavior

Terraform attempts to recreate the resource due to missing route_type and cidr_block attribute.

Displaying the state shows that the route-type attribute was not imported.

terraform state show oci_core_route_table.minimal

resource "oci_core_route_table" "minimal" {
  // other output truncated

  route_rules {
      destination       = "all-ord-services-in-oracle-services-network"
      destination_type  = "SERVICE_CIDR_BLOCK"
      network_entity_id = "ocid1.servicegateway.oc1.us-chicago-1.id"
  }
}
  1. route-type did not get imported.
  2. cidr-type did not import as an explicit null.

Steps to Reproduce

  1. terraform import oci_core_route_table.minimal ocid ocid1.routetable.oc1.us-chicago-1.id
  2. terraform plan

Important Factoids

References

#2070 documents similar behaviour where RT resources get recreated due to changes in the cidr_block. That issue does not cover the use case of importing RT resources.

@nepeat
Copy link
Author

nepeat commented Oct 17, 2024

Looked more into the code, made a code change and was able to fix one part of my issue in #2225

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