From 74e8e9aaa467c0bfdadcd281e11c70512e86ef57 Mon Sep 17 00:00:00 2001 From: "renzheng.wang" Date: Mon, 26 Feb 2024 15:53:03 +0800 Subject: [PATCH] ignore min_cpu_platform change from null to Intel/Auto --- ucloud/resource_ucloud_instance.go | 6 ++++++ ucloud/resource_ucloud_uk8s_cluster.go | 6 ++++++ ucloud/resource_ucloud_uk8s_node.go | 10 +++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ucloud/resource_ucloud_instance.go b/ucloud/resource_ucloud_instance.go index 3a75e5f6..226ed205 100644 --- a/ucloud/resource_ucloud_instance.go +++ b/ucloud/resource_ucloud_instance.go @@ -292,6 +292,12 @@ func resourceUCloudInstance() *schema.Resource { Optional: true, ForceNew: true, Default: "Intel/Auto", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "" && new == "Intel/Auto" { + return true + } + return false + }, }, "cpu_platform": { diff --git a/ucloud/resource_ucloud_uk8s_cluster.go b/ucloud/resource_ucloud_uk8s_cluster.go index 6cc5b099..4071faab 100644 --- a/ucloud/resource_ucloud_uk8s_cluster.go +++ b/ucloud/resource_ucloud_uk8s_cluster.go @@ -202,6 +202,12 @@ func resourceUCloudUK8SCluster() *schema.Resource { Optional: true, ForceNew: true, Default: "Intel/Auto", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "" && new == "Intel/Auto" { + return true + } + return false + }, ValidateFunc: validation.StringInSlice([]string{ "Intel/Auto", "Intel/IvyBridge", diff --git a/ucloud/resource_ucloud_uk8s_node.go b/ucloud/resource_ucloud_uk8s_node.go index 3bacb88f..e6cbf40a 100644 --- a/ucloud/resource_ucloud_uk8s_node.go +++ b/ucloud/resource_ucloud_uk8s_node.go @@ -3,10 +3,11 @@ package ucloud import ( "encoding/base64" "fmt" - "github.com/hashicorp/terraform-plugin-sdk/helper/customdiff" "strings" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/customdiff" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -170,6 +171,13 @@ func resourceUCloudUK8SNode() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + Default: "Intel/Auto", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "" && new == "Intel/Auto" { + return true + } + return false + }, ValidateFunc: validation.StringInSlice([]string{ "Intel/Auto", "Intel/IvyBridge",