Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions rancher2/resource_rancher2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ func resourceRancher2Cluster() *schema.Resource {
d.SetNew("eks_config_v2", flattenClusterEKSConfigV2(newObj, []interface{}{}))
}
}

if d.Get("driver") == clusterDriverGKEV2 && d.HasChange("gke_config_v2") {
old, new := d.GetChange("gke_config_v2")
oldObj := expandClusterGKEConfigV2(old.([]interface{}))
newObj := expandClusterGKEConfigV2(new.([]interface{}))

if reflect.DeepEqual(oldObj, newObj) {
d.Clear("gke_config_v2")
} else {
d.SetNew("gke_config_v2", flattenClusterGKEConfigV2(newObj, []interface{}{}))
}
}

return nil
},
Schema: clusterFields(),
Expand Down
14 changes: 0 additions & 14 deletions rancher2/schema_cluster_gke_config_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ func clusterGKEConfigV2NodePoolConfigFields() map[string]*schema.Schema {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Description: "The GKE node pool node config",
Elem: &schema.Resource{
Expand Down Expand Up @@ -421,7 +420,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The GKE cluster name",
},
"google_credential_secret": {
Expand All @@ -433,7 +431,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
"project_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The GKE project id",
},
"cluster_addons": {
Expand All @@ -450,28 +447,24 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE ip v4 cidr block",
},
"description": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE cluster description",
},
"enable_kubernetes_alpha": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
Description: "Enable Kubernetes alpha",
},
"ip_allocation_policy": {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Description: "The GKE ip allocation policy",
Elem: &schema.Resource{
Expand All @@ -482,7 +475,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
Description: "Is GKE cluster imported?",
},
"kubernetes_version": {
Expand Down Expand Up @@ -522,7 +514,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Description: "The GKE cluster master authorized networks config",
Elem: &schema.Resource{
Expand All @@ -539,7 +530,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE cluster network",
},
"network_policy_enabled": {
Expand All @@ -561,7 +551,6 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
MaxItems: 1,
Description: "The GKE private cluster config",
Elem: &schema.Resource{
Expand All @@ -572,21 +561,18 @@ func clusterGKEConfigV2Fields() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE cluster region. Required if `zone` is empty",
},
"subnetwork": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE cluster subnetwork",
},
"zone": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: "The GKE cluster zone. Required if `region` is empty",
},
}
Expand Down