Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ovh_cloud_project_kube requires load_balancers_subnet_id but doesn't properly update it on the resource #683

Closed
david-jointech opened this issue Jul 10, 2024 · 1 comment · Fixed by #695
Assignees
Labels
Product: Managed Kubernetes Service Status: Coming Soon The feature will hit GA usually in less than 2 months Type: Bug

Comments

@david-jointech
Copy link

Describe the bug

After upgrading the provider from 0.43.1 to 0.46.1, a plan on our ovh_cloud_project_kube resource resulted in the following error:

│ Error: Missing required argument
│
│   with ovh_cloud_project_kube.main,
│   on ovh-cluster.tf line 6, in resource "ovh_cloud_project_kube" "main":
│    6:   private_network_id = tolist(ovh_cloud_project_network_private.net.regions_attributes[*].openstackid)[0]
│
│ "private_network_id": all of `load_balancers_subnet_id,private_network_id` must be specified

The used configuration looked like this:

resource "ovh_cloud_project_kube" "main" {
  service_name             = local.service_name
  name                     = "${var.stage}-k8s"
  region                   = local.stage_config[var.stage].location
  version                  = local.stage_config[var.stage].version
  private_network_id       = tolist(ovh_cloud_project_network_private.net.regions_attributes[*].openstackid)[0]
  depends_on = [
    ovh_cloud_project_network_private.net
  ]
}

I modified the resource, to include the load_balancers_subnet_id as follows:

resource "ovh_cloud_project_kube" "main" {
  service_name             = local.service_name
  name                     = "${var.stage}-k8s"
  region                   = local.stage_config[var.stage].location
  version                  = local.stage_config[var.stage].version
  load_balancers_subnet_id = ovh_cloud_project_network_private_subnet.subnet.id
  private_network_id       = tolist(ovh_cloud_project_network_private.net.regions_attributes[*].openstackid)[0]
  depends_on = [
    ovh_cloud_project_network_private.net
  ]
}

Then running plan and apply successfully finishes. But when running a plan afterwards, the resource wants to update again:

OpenTofu will perform the following actions:

  # ovh_cloud_project_kube.main will be updated in-place
  ~ resource "ovh_cloud_project_kube" "main" {
        id                          = "f1b8dd51-f77c-4c48-8c34-15ee13fc576a"
      + load_balancers_subnet_id    = "9045d2ab-f5b5-4792-9771-fa8c1f12ed99"
        name                        = "dev-k8s"
        # (15 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Here I'd expect no changes to be planned.

First of all, from the documentation it's unclear to me, that load_balancers_subnet_id is required, when private_network_id is set, the last example in the documentation even uses the private_network_id without the load_balancers_subnet_id. It's also slightly unclear to me, which effect the load_balancers_subnet_id will have, though I assume it's not about the external IP of the loadbalancer. Though then I'd assume the nodes_subnet_id should be used here?

Secondly, applying the change to load_balancers_subnet_id doesn't actually seem to have an effect.

Terraform Version

OpenTofu v1.7.0-alpha1

OVH Terraform Provider Version

v0.46.1

Affected Resource(s)

  • ovh_cloud_project_kube

Terraform Configuration Files

relevant part is:

resource "ovh_cloud_project_kube" "main" {
  service_name             = local.service_name
  name                     = "${var.stage}-k8s"
  region                   = local.stage_config[var.stage].location
  version                  = local.stage_config[var.stage].version
  load_balancers_subnet_id = ovh_cloud_project_network_private_subnet.subnet.id
  private_network_id       = tolist(ovh_cloud_project_network_private.net.regions_attributes[*].openstackid)[0]
  depends_on = [
    ovh_cloud_project_network_private.net
  ]
}

Expected Behavior

  1. I'm unsure if load_balancers_subnet_id should actually be required when using private_network_id. Documentation should reflect this requirement.
  2. The resource should be actually updated when setting load_balancers_subnet_id and not produce planned changes on every run.

Actual Behavior

Regarding 1 using private_network_id without load_balancers_subnet_id produces an error.
Regarding 2, the resource is unchanged after applying.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan -out planfile on the first configuration. Error should appear
  2. add load_balancers_subnet_id to configuration
  3. terraform plan -out planfile should work without errors
  4. terraform apply planfile should run succesfully
  5. terraform plan -out planfile will plan the change on the resource again
@mwacker-sms
Copy link

ran into the same issue here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product: Managed Kubernetes Service Status: Coming Soon The feature will hit GA usually in less than 2 months Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants