Create the subnet and cluster using the configuration provided above.
Modify the cidr block of the resource sbercloud_vpc_subnet.k8s_staging_pods (e.g., change from 10.0.2.0/22 to 10.0.4.0/22).
Run terraform apply.
Expected Behavior
The sbercloud_cce_cluster resource should detect the dependency on the updated subnet and recreate accordingly.
Subnet deletion and recreation should not cause timeouts or conflicts.
Actual Behavior
When the sbercloud_vpc_subnet.k8s_staging_pods CIDR is changed, Terraform attempts to delete the subnet but fails because it is still in use by the CCE cluster.
This results in the following error:
│ Error: error deleting Subnet: timeout while waiting for state to become 'DELETED' (last state: 'ACTIVE', timeout: 10m0s)
Planned Resource Changes
# other resources will be updated (for example, the ingress add-on), but not the CCE cluster
#sbercloud_vpc_subnet.k8s_staging_pods must be replaced
-/+ resource "sbercloud_vpc_subnet" "k8s_staging_pods" {
~ cidr = "10.0.2.0/22" -> "10.0.4.0/22" # forces replacement
~ gateway_ip = "10.0.2.1" -> "10.0.4.1" # forces replacement
}
Important Notes
This issue arises because the CCE cluster does not automatically detect and manage the dependency on the subnet when its cidr block changes.
The cluster locks the subnet, causing a timeout during deletion.
To solve the problem, we may need to link it to the lifecycle
Terraform and Provider Versions
v1.9.2
Provider Version:
sbercloud-terraform/sbercloud v1.11.6
Affected Resources
sbercloud_vpc_subnet
sbercloud_cce_cluster
Terraform Configuration Files
Subnet Resource
CCE Cluster Resource
Problem Description
Steps to Reproduce
cidr
block of the resourcesbercloud_vpc_subnet.k8s_staging_pods
(e.g., change from10.0.2.0/22
to10.0.4.0/22
).Expected Behavior
The
sbercloud_cce_cluster
resource should detect the dependency on the updated subnet and recreate accordingly. Subnet deletion and recreation should not cause timeouts or conflicts.Actual Behavior
When the
sbercloud_vpc_subnet.k8s_staging_pods
CIDR is changed, Terraform attempts to delete the subnet but fails because it is still in use by the CCE cluster.This results in the following error:
Planned Resource Changes
Important Notes
cidr
block changes.