@@ -232,6 +232,31 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
232
232
})
233
233
}
234
234
235
+ func TestAccContainerCluster_withNodeConfigNotSorted (t * testing.T ) {
236
+ // Make an update with non sorted oauth_scopes
237
+ resource .Test (t , resource.TestCase {
238
+ PreCheck : func () { testAccPreCheck (t ) },
239
+ Providers : testAccProviders ,
240
+ CheckDestroy : testAccCheckContainerClusterDestroy ,
241
+ Steps : []resource.TestStep {
242
+ {
243
+ Config : testAccContainerCluster_withNodeConfigNotsorted ,
244
+ Check : resource .ComposeTestCheckFunc (
245
+ testAccCheckContainerCluster (
246
+ "google_container_cluster.with_node_config_not_sorted" ),
247
+ ),
248
+ },
249
+ {
250
+ Config : testAccContainerCluster_withNodeConfigNotsorted ,
251
+ Check : resource .ComposeTestCheckFunc (
252
+ testAccCheckContainerCluster (
253
+ "google_container_cluster.with_node_config_not_sorted" ),
254
+ ),
255
+ },
256
+ },
257
+ })
258
+ }
259
+
235
260
func TestAccContainerCluster_withNodeConfigScopeAlias (t * testing.T ) {
236
261
t .Parallel ()
237
262
@@ -535,7 +560,9 @@ func testAccCheckContainerClusterDestroy(s *terraform.State) error {
535
560
}
536
561
537
562
var setFields map [string ]struct {} = map [string ]struct {}{
538
- "additional_zones" : struct {}{},
563
+ "additional_zones" : struct {}{},
564
+ "node_config.0.oauth_scopes" : struct {}{},
565
+ "node_pool.0.node_config.0.oauth_scopes" : struct {}{},
539
566
}
540
567
541
568
func testAccCheckContainerCluster (n string ) resource.TestCheckFunc {
@@ -975,6 +1002,40 @@ resource "google_container_cluster" "with_version" {
975
1002
}` , clusterName )
976
1003
}
977
1004
1005
+ var testAccContainerCluster_withNodeConfigNotsorted = fmt .Sprintf (`
1006
+ resource "google_container_cluster" "with_node_config_not_sorted" {
1007
+ name = "cluster-test-%s"
1008
+ zone = "us-central1-f"
1009
+ initial_node_count = 1
1010
+
1011
+ master_auth {
1012
+ username = "mr.yoda"
1013
+ password = "adoy.rm"
1014
+ }
1015
+
1016
+ node_config {
1017
+ machine_type = "n1-standard-1"
1018
+ disk_size_gb = 15
1019
+ local_ssd_count = 1
1020
+ oauth_scopes = [
1021
+ "https://www.googleapis.com/auth/compute",
1022
+ "https://www.googleapis.com/auth/devstorage.read_only",
1023
+ "https://www.googleapis.com/auth/logging.write",
1024
+ "monitoring"
1025
+ ]
1026
+ service_account = "default"
1027
+ metadata {
1028
+ foo = "bar"
1029
+ }
1030
+ image_type = "COS"
1031
+ labels {
1032
+ foo = "bar"
1033
+ }
1034
+ tags = ["foo", "bar"]
1035
+ preemptible = true
1036
+ }
1037
+ }` , acctest .RandString (10 ))
1038
+
978
1039
var testAccContainerCluster_withNodeConfig = fmt .Sprintf (`
979
1040
resource "google_container_cluster" "with_node_config" {
980
1041
name = "cluster-test-%s"
0 commit comments