Skip to content

Commit d9e350d

Browse files
Backport #1651 to release/v7 (#1661)
Co-authored-by: Krunal Hingu <krunal.hingu222@gmail.com>
1 parent 8165a9e commit d9e350d

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
@@ -318,6 +318,18 @@ func resourceRancher2ClusterUpdate(d *schema.ResourceData, meta interface{}) err
318318
}
319319
}
320320

321+
// imported_config is special because it applies to *any imported cluster*,
322+
// including hosted providers (AKS, EKS, GKE) where `imported = true` is set.
323+
// If we keep it inside the driver-specific switch, it only gets processed
324+
// for the "imported" driver, but NOT for hosted imported clusters.
325+
// To avoid this bug, we always check imported_config here before switching on driver.
326+
if v, ok := d.GetOk("imported_config"); ok {
327+
importedConfig := v.([]interface{})
328+
if len(importedConfig) > 0 {
329+
update["importedConfig"] = expandClusterImportedConfig(importedConfig)
330+
}
331+
}
332+
321333
replace := false
322334
switch driver := ToLower(d.Get("driver").(string)); driver {
323335
case clusterDriverAKS:
@@ -366,8 +378,6 @@ func resourceRancher2ClusterUpdate(d *schema.ResourceData, meta interface{}) err
366378
case clusterDriverRKE2:
367379
update["rke2Config"] = expandClusterRKE2Config(d.Get("rke2_config").([]interface{}))
368380
replace = d.HasChange("cluster_agent_deployment_customization")
369-
case clusterDriverImported:
370-
update["importedConfig"] = expandClusterImportedConfig(d.Get("imported_config").([]interface{}))
371381
}
372382

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

0 commit comments

Comments
 (0)