Skip to content

Commit fd60840

Browse files
committed
fix: Merge changes from branch 'master'
2 parents 2f6dfcb + 56a7b45 commit fd60840

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

rancher2/resource_rancher2_cluster.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ func resourceRancher2Cluster() *schema.Resource {
3535
d.SetNew("eks_config_v2", flattenClusterEKSConfigV2(newObj, []interface{}{}))
3636
}
3737
}
38+
39+
if d.Get("driver") == clusterDriverGKEV2 && d.HasChange("gke_config_v2") {
40+
old, new := d.GetChange("gke_config_v2")
41+
oldObj := expandClusterGKEConfigV2(old.([]interface{}))
42+
newObj := expandClusterGKEConfigV2(new.([]interface{}))
43+
44+
if reflect.DeepEqual(oldObj, newObj) {
45+
d.Clear("gke_config_v2")
46+
} else {
47+
d.SetNew("gke_config_v2", flattenClusterGKEConfigV2(newObj, []interface{}{}))
48+
}
49+
}
50+
3851
return nil
3952
},
4053
Schema: clusterFields(),

rancher2/schema_cluster_gke_config_v2.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ func clusterGKEConfigV2NodePoolConfigFields() map[string]*schema.Schema {
364364
Type: schema.TypeList,
365365
Optional: true,
366366
Computed: true,
367-
ForceNew: true,
368367
MaxItems: 1,
369368
Description: "The GKE node pool node config",
370369
Elem: &schema.Resource{
@@ -421,7 +420,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
421420
"name": {
422421
Type: schema.TypeString,
423422
Required: true,
424-
ForceNew: true,
425423
Description: "The GKE cluster name",
426424
},
427425
"google_credential_secret": {
@@ -433,7 +431,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
433431
"project_id": {
434432
Type: schema.TypeString,
435433
Required: true,
436-
ForceNew: true,
437434
Description: "The GKE project id",
438435
},
439436
"cluster_addons": {
@@ -450,28 +447,24 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
450447
Type: schema.TypeString,
451448
Optional: true,
452449
Computed: true,
453-
ForceNew: true,
454450
Description: "The GKE ip v4 cidr block",
455451
},
456452
"description": {
457453
Type: schema.TypeString,
458454
Optional: true,
459455
Computed: true,
460-
ForceNew: true,
461456
Description: "The GKE cluster description",
462457
},
463458
"enable_kubernetes_alpha": {
464459
Type: schema.TypeBool,
465460
Optional: true,
466461
Computed: true,
467-
ForceNew: true,
468462
Description: "Enable Kubernetes alpha",
469463
},
470464
"ip_allocation_policy": {
471465
Type: schema.TypeList,
472466
Optional: true,
473467
Computed: true,
474-
ForceNew: true,
475468
MaxItems: 1,
476469
Description: "The GKE ip allocation policy",
477470
Elem: &schema.Resource{
@@ -482,7 +475,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
482475
Type: schema.TypeBool,
483476
Optional: true,
484477
Default: false,
485-
ForceNew: true,
486478
Description: "Is GKE cluster imported?",
487479
},
488480
"kubernetes_version": {
@@ -522,7 +514,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
522514
Type: schema.TypeList,
523515
Optional: true,
524516
Computed: true,
525-
ForceNew: true,
526517
MaxItems: 1,
527518
Description: "The GKE cluster master authorized networks config",
528519
Elem: &schema.Resource{
@@ -539,7 +530,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
539530
Type: schema.TypeString,
540531
Optional: true,
541532
Computed: true,
542-
ForceNew: true,
543533
Description: "The GKE cluster network",
544534
},
545535
"network_policy_enabled": {
@@ -561,7 +551,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
561551
Type: schema.TypeList,
562552
Optional: true,
563553
Computed: true,
564-
ForceNew: true,
565554
MaxItems: 1,
566555
Description: "The GKE private cluster config",
567556
Elem: &schema.Resource{
@@ -572,21 +561,18 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
572561
Type: schema.TypeString,
573562
Optional: true,
574563
Computed: true,
575-
ForceNew: true,
576564
Description: "The GKE cluster region. Required if `zone` is empty",
577565
},
578566
"subnetwork": {
579567
Type: schema.TypeString,
580568
Optional: true,
581569
Computed: true,
582-
ForceNew: true,
583570
Description: "The GKE cluster subnetwork",
584571
},
585572
"zone": {
586573
Type: schema.TypeString,
587574
Optional: true,
588575
Computed: true,
589-
ForceNew: true,
590576
Description: "The GKE cluster zone. Required if `region` is empty",
591577
},
592578
}

0 commit comments

Comments
 (0)