Skip to content

Commit 1273c6f

Browse files
Backport 1651 release/v8 (#1660)
Co-authored-by: Krunal Hingu <krunal.hingu222@gmail.com>
1 parent 713d10f commit 1273c6f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

rancher2/resource_rancher2_cluster.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,18 @@ func resourceRancher2ClusterUpdate(d *schema.ResourceData, meta interface{}) err
321321
}
322322
}
323323

324+
// imported_config is special because it applies to *any imported cluster*,
325+
// including hosted providers (AKS, EKS, GKE) where `imported = true` is set.
326+
// If we keep it inside the driver-specific switch, it only gets processed
327+
// for the "imported" driver, but NOT for hosted imported clusters.
328+
// To avoid this bug, we always check imported_config here before switching on driver.
329+
if v, ok := d.GetOk("imported_config"); ok {
330+
importedConfig := v.([]interface{})
331+
if len(importedConfig) > 0 {
332+
update["importedConfig"] = expandClusterImportedConfig(importedConfig)
333+
}
334+
}
335+
324336
replace := false
325337
switch driver := ToLower(d.Get("driver").(string)); driver {
326338
case ToLower(clusterDriverAKSV2):
@@ -346,8 +358,6 @@ func resourceRancher2ClusterUpdate(d *schema.ResourceData, meta interface{}) err
346358
case clusterDriverRKE2:
347359
update["rke2Config"] = expandClusterRKE2Config(d.Get("rke2_config").([]interface{}))
348360
replace = d.HasChange("cluster_agent_deployment_customization")
349-
case clusterDriverImported:
350-
update["importedConfig"] = expandClusterImportedConfig(d.Get("imported_config").([]interface{}))
351361
}
352362

353363
// update the cluster; retry til timeout or non retryable error is returned. If api 500 error is received,

0 commit comments

Comments
 (0)