oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
760 stars 683 forks source link

Error: Cycle: oci_core_route_table.this, oci_core_vlan.this #2243

Open olkoko opened 1 week ago

olkoko commented 1 week ago

Community Note

Terraform Version and Provider Version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/oracle/oci v6.18.0

Affected Resource(s)

oci_core_vlan
oci_core_route_table
oci_core_private_ip

Terraform Configuration Files

resource "oci_core_vcn" "this" {
  compartment_id = var.network_compartment_id
  display_name   = "test vcn"
  cidr_blocks    = "10.0.0.0/16"
}

resource "oci_core_vlan" "this" {
  compartment_id = var.network_compartment_id
  vcn_id         = oci_core_vcn.this.id
  display_name   = "test vlan"
  cidr_block     = "10.0.100.0/24"
  vlan_tag       = "100"
  route_table_id = oci_core_route_table.this.id
}

resource "oci_core_route_table" "this" {
  compartment_id = var.network_compartment_id
  vcn_id         = oci_core_vcn.this.id
  display_name   = "test route table"
  route_rules {
    cidr_block        = "0.0.0.0/0"
    network_entity_id = oci_core_vlan.this.id
  }
}

resource "oci_core_private_ip" "this" {
  display_name  = "test iprivate ip"
  ip_address    = "10.0.100.5"
  vlan_id       = oci_core_vlan.this.id
}

Debug Output

Expected Behavior

This should create a route table for VLAN with entry referencing Private IP in this VLAN.

Actual Behavior

Error: Cycle: oci_core_route_table.this, oci_core_vlan.this

Steps to Reproduce

See teraform configuration above.

References

This has been fixed for OCI Subnets back in 2018 by introducing oci_core_route_table_attachment.

Proposed fix is to enhance oci_core_route_table_attachment to support VLANs.