@@ -2367,9 +2367,12 @@ func TestAccContainerCluster_withBootDiskKmsKey(t *testing.T) {
2367
2367
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
2368
2368
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
2369
2369
2370
- if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") {
2371
- t.Fatal("Stopping the test because a role was added to the policy.")
2372
- }
2370
+ acctest.BootstrapIamMembers(t, []acctest.IamMember{
2371
+ {
2372
+ Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com",
2373
+ Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
2374
+ },
2375
+ })
2373
2376
2374
2377
acctest.VcrTest(t, resource.TestCase{
2375
2378
PreCheck: func() { acctest.AccTestPreCheck(t) },
@@ -4414,9 +4417,12 @@ func TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey(t *testi
4414
4417
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
4415
4418
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
4416
4419
4417
- if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") {
4418
- t.Fatal("Stopping the test because a role was added to the policy.")
4419
- }
4420
+ acctest.BootstrapIamMembers(t, []acctest.IamMember{
4421
+ {
4422
+ Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com",
4423
+ Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
4424
+ },
4425
+ })
4420
4426
4421
4427
acctest.VcrTest(t, resource.TestCase{
4422
4428
PreCheck: func() { acctest.AccTestPreCheck(t) },
@@ -5544,14 +5550,20 @@ func TestAccContainerCluster_WithCPAFeatures(t *testing.T) {
5544
5550
// *ALL* Cloud KMS keys in the project. A more realistic usage would be to
5545
5551
// grant the service agent the necessary roles only on the individual keys
5546
5552
// we have created.
5547
- roles := []string{
5548
- "roles/container.cloudKmsKeyUser",
5549
- "roles/privateca.certificateManager",
5550
- "roles/cloudkms.cryptoKeyEncrypterDecrypter",
5551
- }
5552
- if acctest.BootstrapPSARoles(t, "service-", "container-engine-robot", roles) {
5553
- t.Fatal("Stopping the test because a role was added to the policy.")
5554
- }
5553
+ acctest.BootstrapIamMembers(t, []acctest.IamMember{
5554
+ {
5555
+ Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com",
5556
+ Role: "roles/container.cloudKmsKeyUser",
5557
+ },
5558
+ {
5559
+ Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com",
5560
+ Role: "roles/privateca.certificateManager",
5561
+ },
5562
+ {
5563
+ Member: "serviceAccount:service-{project_number}@container-engine-robot.iam.gserviceaccount.com",
5564
+ Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
5565
+ },
5566
+ })
5555
5567
5556
5568
// Find an active cryptoKeyVersion on the signing key.
5557
5569
var signingCryptoKeyVersion *cloudkms.CryptoKeyVersion
@@ -11464,9 +11476,12 @@ func TestAccContainerCluster_withConfidentialBootDisk(t *testing.T) {
11464
11476
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
11465
11477
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
11466
11478
11467
- if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") {
11468
- t.Fatal("Stopping the test because a role was added to the policy.")
11469
- }
11479
+ acctest.BootstrapIamMembers(t, []acctest.IamMember{
11480
+ {
11481
+ Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com",
11482
+ Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
11483
+ },
11484
+ })
11470
11485
11471
11486
acctest.VcrTest(t, resource.TestCase{
11472
11487
PreCheck: func() { acctest.AccTestPreCheck(t) },
@@ -11527,9 +11542,12 @@ func TestAccContainerCluster_withConfidentialBootDiskNodeConfig(t *testing.T) {
11527
11542
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
11528
11543
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
11529
11544
11530
- if acctest.BootstrapPSARole(t, "service-", "compute-system", "roles/cloudkms.cryptoKeyEncrypterDecrypter") {
11531
- t.Fatal("Stopping the test because a role was added to the policy.")
11532
- }
11545
+ acctest.BootstrapIamMembers(t, []acctest.IamMember{
11546
+ {
11547
+ Member: "serviceAccount:service-{project_number}@compute-system.iam.gserviceaccount.com",
11548
+ Role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
11549
+ },
11550
+ })
11533
11551
11534
11552
acctest.VcrTest(t, resource.TestCase{
11535
11553
PreCheck: func() { acctest.AccTestPreCheck(t) },
0 commit comments