diff --git a/.changelog/4554.txt b/.changelog/4554.txt new file mode 100644 index 00000000000..7639f539bf9 --- /dev/null +++ b/.changelog/4554.txt @@ -0,0 +1,3 @@ +```release-note:bug +container: fixed an issue where release channel UNSPECIFIED could not be set +``` diff --git a/google/resource_container_cluster.go b/google/resource_container_cluster.go index 07ad4586d6b..a6347456ce6 100644 --- a/google/resource_container_cluster.go +++ b/google/resource_container_cluster.go @@ -906,10 +906,9 @@ func resourceContainerCluster() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "channel": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{"UNSPECIFIED", "RAPID", "REGULAR", "STABLE"}, false), - DiffSuppressFunc: emptyOrDefaultStringSuppress("UNSPECIFIED"), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"UNSPECIFIED", "RAPID", "REGULAR", "STABLE"}, false), Description: `The selected release channel. Accepted values are: * UNSPECIFIED: Not set. * RAPID: Weekly upgrade cadence; Early testers and developers who requires new features. @@ -2961,12 +2960,12 @@ func flattenVerticalPodAutoscaling(c *containerBeta.VerticalPodAutoscaling) []ma func flattenReleaseChannel(c *containerBeta.ReleaseChannel) []map[string]interface{} { result := []map[string]interface{}{} - if c != nil { + if c != nil && c.Channel != "" { result = append(result, map[string]interface{}{ "channel": c.Channel, }) } else { - // Explicitly set the release channel to the default. + // Explicitly set the release channel to the UNSPECIFIED. result = append(result, map[string]interface{}{ "channel": "UNSPECIFIED", }) diff --git a/google/resource_container_node_pool_test.go b/google/resource_container_node_pool_test.go index 4ef0711c619..d6580d96c06 100644 --- a/google/resource_container_node_pool_test.go +++ b/google/resource_container_node_pool_test.go @@ -1005,6 +1005,9 @@ resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" initial_node_count = 1 + release_channel { + channel = "UNSPECIFIED" + } } resource "google_container_node_pool" "np_with_management" {