Open
Description
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"'
cidr-block
should be imported as an explicit null value in the state.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"
}
}
route-type
did not get imported.cidr-type
did not import as an explicit null.
Steps to Reproduce
terraform import oci_core_route_table.minimal ocid ocid1.routetable.oc1.us-chicago-1.id
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.