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] Terraform tries to reattach a nodegroup to a replaced cluster #1541

Closed
jan-di opened this issue Apr 3, 2023 · 1 comment · Fixed by #1551
Closed

[Bug] Terraform tries to reattach a nodegroup to a replaced cluster #1541

jan-di opened this issue Apr 3, 2023 · 1 comment · Fixed by #1551

Comments

@jan-di
Copy link

jan-di commented Apr 3, 2023

The documentation states, that if the cluster_id of a nodegroup changes, the nodegroup will be recreated.
Actually, terraform tries to reattach the nodegroup by updating the cluster_id in place.

Terraform Version

1.4.2, shouldn't be related to version.

Affected Resource(s)

  • openstack_containerinfra_nodegroup_v1

Terraform Configuration Files

resource "openstack_containerinfra_nodegroup_v1" "static" {
  name         = each.value.name
  cluster_id   = local.cluster.id
  node_count   = 1

}

Expected Behavior

Cluster gets replaced, therefore cluster will have a new id
After terraform recreated the cluster, it tries to update the nodegroup with the new ID of the parent cluster. This won't work, as you cannot attach an existing nodegroup to a new cluster.

Actual Behavior

Terraform detects the change of cluster ID and replaces the nodegroup with a new one.

Steps to Reproduce

  1. terraform apply -replace "path.to.parent.cluster"

Possible Solution

I'm not too deep into the sourcecode, but I guess the ForceNew property of cluster_id must be set to true.

https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/resource_openstack_containerinfra_nodegroup_v1.go#LL45C10-L45C10

@mnaser
Copy link
Collaborator

mnaser commented Apr 20, 2023

Indeed, you're right, if the cluster_id is to be changed, the node group should indeed disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants