@@ -77,6 +77,51 @@ func TestAccContainerAwsCluster_BasicHandWritten(t *testing.T) {
7777 },
7878 })
7979}
80+ func TestAccContainerAwsCluster_BetaBasicHandWritten (t * testing.T ) {
81+ t .Parallel ()
82+
83+ context := map [string ]interface {}{
84+ "aws_acct_id" : "111111111111" ,
85+ "aws_db_key" : "00000000-0000-0000-0000-17aad2f0f61f" ,
86+ "aws_region" : "us-west-2" ,
87+ "aws_sg" : "sg-0b3f63cb91b247628" ,
88+ "aws_subnet" : "subnet-0b3f63cb91b247628" ,
89+ "aws_vol_key" : "00000000-0000-0000-0000-17aad2f0f61f" ,
90+ "aws_vpc" : "vpc-0b3f63cb91b247628" ,
91+ "byo_prefix" : "mmv2" ,
92+ "project_name" : envvar .GetTestProjectFromEnv (),
93+ "project_number" : envvar .GetTestProjectNumberFromEnv (),
94+ "service_acct" : envvar .GetTestServiceAccountFromEnv (t ),
95+ "random_suffix" : RandString (t , 10 ),
96+ }
97+
98+ VcrTest (t , resource.TestCase {
99+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
100+
101+ ProtoV5ProviderFactories : ProtoV5ProviderBetaFactories (t ),
102+ CheckDestroy : testAccCheckContainerAwsClusterDestroyProducer (t ),
103+ Steps : []resource.TestStep {
104+ {
105+ Config : testAccContainerAwsCluster_BetaBasicHandWritten (context ),
106+ },
107+ {
108+ ResourceName : "google_container_aws_cluster.primary" ,
109+ ImportState : true ,
110+ ImportStateVerify : true ,
111+ ImportStateVerifyIgnore : []string {"fleet.0.project" },
112+ },
113+ {
114+ Config : testAccContainerAwsCluster_BetaBasicHandWrittenUpdate0 (context ),
115+ },
116+ {
117+ ResourceName : "google_container_aws_cluster.primary" ,
118+ ImportState : true ,
119+ ImportStateVerify : true ,
120+ ImportStateVerifyIgnore : []string {"fleet.0.project" },
121+ },
122+ },
123+ })
124+ }
80125
81126func testAccContainerAwsCluster_BasicHandWritten (context map [string ]interface {}) string {
82127 return acctest .Nprintf (`
@@ -255,6 +300,212 @@ resource "google_container_aws_cluster" "primary" {
255300}
256301
257302
303+ ` , context )
304+ }
305+
306+ func testAccContainerAwsCluster_BetaBasicHandWritten (context map [string ]interface {}) string {
307+ return acctest .Nprintf (`
308+ data "google_container_aws_versions" "versions" {
309+ provider = google-beta
310+ project = "%{project_name}"
311+ location = "us-west1"
312+ }
313+
314+ resource "google_container_aws_cluster" "primary" {
315+ provider = google-beta
316+ authorization {
317+ admin_users {
318+ username = "%{service_acct}"
319+ }
320+ }
321+
322+ aws_region = "%{aws_region}"
323+
324+ control_plane {
325+ aws_services_authentication {
326+ role_arn = "arn:aws:iam::%{aws_acct_id}:role/%{byo_prefix}-1p-dev-oneplatform"
327+ role_session_name = "%{byo_prefix}-1p-dev-session"
328+ }
329+
330+ config_encryption {
331+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_db_key}"
332+ }
333+
334+ database_encryption {
335+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_db_key}"
336+ }
337+
338+ iam_instance_profile = "%{byo_prefix}-1p-dev-controlplane"
339+ subnet_ids = ["%{aws_subnet}"]
340+ version = "${data.google_container_aws_versions.versions.valid_versions[0]}"
341+ instance_type = "t3.medium"
342+
343+ main_volume {
344+ iops = 3000
345+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_vol_key}"
346+ size_gib = 10
347+ volume_type = "GP3"
348+ }
349+
350+ proxy_config {
351+ secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF"
352+ secret_version = "12345678-ABCD-EFGH-IJKL-987654321098"
353+ }
354+
355+ root_volume {
356+ iops = 3000
357+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_vol_key}"
358+ size_gib = 10
359+ volume_type = "GP3"
360+ }
361+
362+ security_group_ids = ["%{aws_sg}"]
363+
364+ ssh_config {
365+ ec2_key_pair = "%{byo_prefix}-1p-dev-ssh"
366+ }
367+
368+ tags = {
369+ owner = "%{service_acct}"
370+ }
371+
372+ instance_placement {
373+ tenancy = "DEDICATED"
374+ }
375+ }
376+
377+ fleet {
378+ project = "%{project_number}"
379+ }
380+
381+ location = "us-west1"
382+ name = "tf-test-name%{random_suffix}"
383+
384+ networking {
385+ pod_address_cidr_blocks = ["10.2.0.0/16"]
386+ service_address_cidr_blocks = ["10.1.0.0/16"]
387+ vpc_id = "%{aws_vpc}"
388+ }
389+
390+ annotations = {
391+ label-one = "value-one"
392+ }
393+
394+ description = "A sample aws cluster"
395+ project = "%{project_name}"
396+
397+ logging_config {
398+ component_config {
399+ enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
400+ }
401+ }
402+
403+ }
404+
405+
406+ ` , context )
407+ }
408+
409+ func testAccContainerAwsCluster_BetaBasicHandWrittenUpdate0 (context map [string ]interface {}) string {
410+ return acctest .Nprintf (`
411+ data "google_container_aws_versions" "versions" {
412+ provider = google-beta
413+ project = "%{project_name}"
414+ location = "us-west1"
415+ }
416+
417+ resource "google_container_aws_cluster" "primary" {
418+ provider = google-beta
419+ authorization {
420+ admin_users {
421+ username = "%{service_acct}"
422+ }
423+ }
424+
425+ aws_region = "%{aws_region}"
426+
427+ control_plane {
428+ aws_services_authentication {
429+ role_arn = "arn:aws:iam::%{aws_acct_id}:role/%{byo_prefix}-1p-dev-oneplatform"
430+ role_session_name = "%{byo_prefix}-1p-dev-session"
431+ }
432+
433+ config_encryption {
434+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_db_key}"
435+ }
436+
437+ database_encryption {
438+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_db_key}"
439+ }
440+
441+ iam_instance_profile = "%{byo_prefix}-1p-dev-controlplane"
442+ subnet_ids = ["%{aws_subnet}"]
443+ version = "${data.google_container_aws_versions.versions.valid_versions[0]}"
444+ instance_type = "t3.medium"
445+
446+ main_volume {
447+ iops = 3000
448+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_vol_key}"
449+ size_gib = 10
450+ volume_type = "GP3"
451+ }
452+
453+ proxy_config {
454+ secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF"
455+ secret_version = "12345678-ABCD-EFGH-IJKL-987654321098"
456+ }
457+
458+ root_volume {
459+ iops = 3000
460+ kms_key_arn = "arn:aws:kms:%{aws_region}:%{aws_acct_id}:key/%{aws_vol_key}"
461+ size_gib = 10
462+ volume_type = "GP3"
463+ }
464+
465+ security_group_ids = ["%{aws_sg}"]
466+
467+ ssh_config {
468+ ec2_key_pair = "%{byo_prefix}-1p-dev-ssh"
469+ }
470+
471+ tags = {
472+ owner = "updated-%{service_acct}"
473+ }
474+
475+ instance_placement {
476+ tenancy = "DEDICATED"
477+ }
478+ }
479+
480+ fleet {
481+ project = "%{project_number}"
482+ }
483+
484+ location = "us-west1"
485+ name = "tf-test-name%{random_suffix}"
486+
487+ networking {
488+ pod_address_cidr_blocks = ["10.2.0.0/16"]
489+ service_address_cidr_blocks = ["10.1.0.0/16"]
490+ vpc_id = "%{aws_vpc}"
491+ }
492+
493+ annotations = {
494+ label-two = "value-two"
495+ }
496+
497+ description = "An updated sample aws cluster"
498+ project = "%{project_name}"
499+
500+ logging_config {
501+ component_config {
502+ enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
503+ }
504+ }
505+
506+ }
507+
508+
258509` , context )
259510}
260511
0 commit comments