@@ -142,6 +142,35 @@ resource "ovh_cloud_project_kube_nodepool" "pool" {
142142}
143143`
144144
145+ var testAccCloudProjectKubeNodePoolConfigUpdatedScaleToZero = `
146+ resource "ovh_cloud_project_kube" "cluster" {
147+ service_name = "%s"
148+ name = "%s"
149+ region = "%s"
150+ version = "%s"
151+ }
152+
153+ resource "ovh_cloud_project_kube_nodepool" "pool" {
154+ service_name = ovh_cloud_project_kube.cluster.service_name
155+ kube_id = ovh_cloud_project_kube.cluster.id
156+ name = ovh_cloud_project_kube.cluster.name
157+ flavor_name = "b2-7"
158+ desired_nodes = 0
159+ min_nodes = 0
160+ max_nodes = 2
161+ template {
162+ metadata {
163+ annotations = {
164+ a2 = "av2"
165+ }
166+ labels = {
167+ l2 = "lv2"
168+ }
169+ }
170+ }
171+ }
172+ `
173+
145174func TestAccCloudProjectKubeNodePool (t * testing.T ) {
146175 name := acctest .RandomWithPrefix (test_prefix )
147176 region := os .Getenv ("OVH_CLOUD_PROJECT_KUBE_REGION_TEST" )
@@ -161,6 +190,13 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) {
161190 region ,
162191 version ,
163192 )
193+ configUpdatedScaleToZero := fmt .Sprintf (
194+ testAccCloudProjectKubeNodePoolConfigUpdatedScaleToZero ,
195+ os .Getenv ("OVH_CLOUD_PROJECT_SERVICE_TEST" ),
196+ name ,
197+ region ,
198+ version ,
199+ )
164200
165201 resource .Test (t , resource.TestCase {
166202 PreCheck : func () {
@@ -209,6 +245,24 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) {
209245 resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.taints.#" , "0" ),
210246 ),
211247 },
248+ {
249+ Config : configUpdatedScaleToZero ,
250+ Check : resource .ComposeTestCheckFunc (
251+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "region" , region ),
252+ resource .TestCheckResourceAttrSet ("ovh_cloud_project_kube.cluster" , "kubeconfig" ),
253+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "name" , name ),
254+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "version" , version ),
255+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "name" , name ),
256+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "flavor_name" , "b2-7" ),
257+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "desired_nodes" , "0" ),
258+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "min_nodes" , "0" ),
259+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "max_nodes" , "2" ),
260+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.annotations.a2" , "av2" ),
261+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.finalizers.#" , "0" ),
262+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.labels.l2" , "lv2" ),
263+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.taints.#" , "0" ),
264+ ),
265+ },
212266 {
213267 ResourceName : resourceName ,
214268 ImportState : true ,
0 commit comments