ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
183 stars 134 forks source link

ovh_cloud_network_private id vs openstack network id #87

Closed falmar closed 7 months ago

falmar commented 5 years ago

Terraform Version

Terraform v0.12.1

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "ovh_vrack_cloudproject" "attach" {

}

data "openstack_networking_network_v2" "public" {
  name = "Ext-Net"
}

# trying to get around the issue, causes more problems
data openstack_networking_network_v2 "k8s" {
  name = ovh_cloud_network_private.k8s.name

  depends_on = [
    ovh_cloud_network_private.k8s
  ]
}
# ISSUE HERE:
resource "ovh_cloud_network_private" "k8s" {
  name = "k8s_network"
  vlan_id = 3

  regions = [
    data.ovh_cloud_region.east_va_1.name
  ]

  depends_on = [
    ovh_vrack_cloudproject.attach
  ]
}

resource "ovh_cloud_network_private_subnet" "cplane" {
  network_id = ovh_cloud_network_private.k8s.id

  region = data.ovh_cloud_region.east_va_1.name

  network = "192.168.1.0/24"
  start = "192.168.1.10"
  end = "192.168.1.15"
  dhcp = false
  no_gateway = false

  depends_on = [
    ovh_cloud_network_private.k8s
  ]
}

resource "openstack_networking_port_v2" "cplane_private" {
  count = 2

  network_id = data.openstack_networking_network_v2.k8s.id

  admin_state_up = true

  fixed_ip {
    subnet_id = ovh_cloud_network_private_subnet.cplane.id
    ip_address = "192.168.1.${(10+count.index)}"
  }

  security_group_ids = [
    openstack_networking_secgroup_v2.k8s_cplane.id
  ]

  depends_on = [
    ovh_cloud_network_private_subnet.cplane
  ]
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

I would like to create core OpenStack resources, but the OVH private network does not provide the underlying OpenStack Network UUID

Actual Behavior

Expected openstack_networking_network_v2 to provide the underlying network uuid to be used with core resources

Steps to Reproduce

  1. terraform apply multiple times you will see the network_ports keeps being recreated because the data.network... is threaded like a different value all the time

Important Factoids

Not many, just trying to get public cloud instances on vRack

References

N/A

131 commented 2 years ago

Yes, it does, use ovh_cloud_project_network_private.XXXX.regions_attributes[0].openstackid

amstuta commented 7 months ago

@falmar question seems to be answered so I'm closing this issue, don't hesitate to reopen it if needed / not fixed by a more recent version of the providers.