terraform-provider-ovh icon indicating copy to clipboard operation
terraform-provider-ovh copied to clipboard

[BUG] Cannot update regions on existing private network

Open xtof-osd opened this issue 1 year ago • 3 comments

Describe the bug

When updating an existing private network, e.g. adding a region, the provider plans to destroy and recreate existing resource. This fails to happen if any instance is attached to network to update.

This prevents activating a new region on an existing network.

Terraform Version

Terraform v1.3.7 on linux_amd64

  • provider registry.terraform.io/ovh/ovh v0.28.1

OVH Terraform Provider Version

Initializing provider plugins...

  • Reusing previous version of ovh/ovh from the dependency lock file
  • Using previously-installed ovh/ovh v0.28.1

Affected Resource(s)

  • ovh_cloud_project_network_private
  • ovh_cloud_project_network_private_subnet

Terraform Configuration Files

Extract from terraform config

resource "ovh_cloud_project_network_private" "l4_pnet_0" {
  service_name = module.l4_constants.lease4_project_name
  name         = "lease4_pvn1"
  regions      = ["GRA11", "GRA9", "SBG5", "SBG7"]
  vlan_id      = 0
}

Debug Output

│ Error: calling DELETE /cloud/project/7629b555ceb34d1fbacb103216800850/network/private/32df12c0-60f5-4b21-a89c-298d7815325b/subnet/32df12c0-60f5-4b21-a89c-298d7815325b:
│ 	 "HTTP Error 400: Client::BadRequest: \"Unable to complete operation on subnet 32df12c0-60f5-4b21-a89c-298d7815325b: One or more ports have an IP allocation from this subnet.\" (X-OVH-Query-Id: EU.ext-1.641dda47.39055.2d23e98e-d952-4c5f-966e-bb221dc96c71)"
│ 
╷
│ Error: calling DELETE /cloud/project/7629b555ceb34d1fbacb103216800850/network/private/c3d5cefd-8793-4d71-802b-f2e9d6db5de2/subnet/c3d5cefd-8793-4d71-802b-f2e9d6db5de2:
│ 	 "HTTP Error 400: Client::BadRequest: \"Unable to complete operation on subnet c3d5cefd-8793-4d71-802b-f2e9d6db5de2: One or more ports have an IP allocation from this subnet.\" (X-OVH-Query-Id: EU.ext-3.641dda47.17392.922538cc-843c-4424-a7f4-995280b5a01d)"
│ 

Expected Behavior

network should be updated => new region activated using dedicated OVH API endpoint.

The same stands for subnets where ipPools can not be updated

Actual Behavior

Configuration is not applied as resource cannot be deleted.

xtof-osd avatar Mar 24 '23 17:03 xtof-osd

Hello, For terraform network management we encourage users to use openstack provider In OVH documentation, this is stated here The network management in ovh provider is here because in the past, it was not possible to use the openstack.

We will clearly state that in ovh provider.

yomovh avatar Apr 04 '23 07:04 yomovh

Ok for that, I'm switching to openstasck provider for that part.

And yes, ovh provider for terraform lacks documentation a lot....

xtof-osd avatar Apr 05 '23 14:04 xtof-osd

@yomovh I think this is a valid misbehavior / bug, even though the original misdirects to openstack not letting you remove a network if there are ports attached.

The API call for adding a region already exists here.

The user should be able to add additional regions without destruction of the entire network.

efthymiosh avatar Jun 28 '23 09:06 efthymiosh