opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
85 stars 76 forks source link

CSS failing because CIDR Block in VPC produced by opentelekomcloud_networking_router_v2 is missing. #2602

Open thomaswetzler opened 1 month ago

thomaswetzler commented 1 month ago

Terraform provider version

terraform --version Terraform v1.9.2 on darwin_arm64

Affected Resource(s)

Terraform Configuration Files

resource "opentelekomcloud_networking_router_v2" "router" {
  name             = var.name
  admin_state_up   = "true"
  external_gateway = var.internet ? "0a2228f2-7f8a-45f1-8e09-9039e1d09975" : ""
}

Debug Output/Panic Output

Error: error creating CSS cluster: Bad request with: [POST https://css.eu-de.otc.t-systems.com/v1.0/85a9edeb35004b0d980ff5116452814b/clusters], error message: {"errCode":"CSS.0001","externalMessage":"CSS.0001 : Incorrect parameters. (the cidr of vpc external is null, need to set the cidr)"}

Steps to Reproduce

Create a VPC and a subnet with terraform. Afterwards try to create a CSS with terraform or the UI. After producing the VPC with UI, everythink works! The difference is that in terraform VPC the CIDR Block is "--", the UI VPC has a CIDR Bock "192.168.0.0/16".

Expected Behavior

CSS shoud be deployed, the VPC shoud have assigned a CIDR Bock. (Subnet has it). There should be a possibility to set the CIDR within the "opentelekomcloud_networking_router_v2" resource.

Actual Behavior

No CIDR Block assigned to VPC, the CSS deployment fails with the Panic Output above.

Important Factoids

Running on eu-de

References

none

anton-sidelnikov commented 1 month ago

Hi @thomaswetzler, yes interesting issue, by default primary cidr not assigned, but subnet with cidr attached, so I created internal issue https://jira.tsi-dev.otc-service.com/browse/BM-5659. I only can suggest you to use VPC api for CSS https://docs.otc.t-systems.com/virtual-private-cloud/api-ref/apis/virtual_private_cloud/creating_a_vpc.html#vpc-api01-0001 and tf resource:

resource "opentelekomcloud_vpc_v1" "vpc_sec_cidr" {
  name           = "tf_vpc"
  description    = "description"
  cidr           = "192.168.0.0/16"
  secondary_cidr = "23.9.0.0/16"

  tags = {
    foo = "bar"
    key = "value"
  }
}
thomaswetzler commented 1 month ago

Hi Anton,

opentelekomcloud_vpc_v1 was my favorite for a while. Unfortunately, the resource cannot provide the router ID. I remember that I need it to create VPC routing. It is present in opentelekomcloud_networking_router_v2, but not in opentelekomcloud_vpc_v1.

BR

Thomas

anton-sidelnikov commented 1 month ago

Hi @thomaswetzler, but for routing there are opentelekomcloud_vpc_route_v2 and opentelekomcloud_vpc_route_table_v1, and also for some resources vpc_id equal to router_id, but i think you won't find this note in documentation.