@@ -66,6 +66,12 @@ resource "google_integrations_client" "example" {
66
66
func TestAccIntegrationsClient_integrationsClientFullExample (t * testing.T ) {
67
67
acctest .SkipIfVcr (t )
68
68
t .Parallel ()
69
+ acctest .BootstrapIamMembers (t , []acctest.IamMember {
70
+ {
71
+ Member : "serviceAccount:service-{project_number}@gcp-sa-integrations.iam.gserviceaccount.com" ,
72
+ Role : "roles/cloudkmskacls.serviceAgent" ,
73
+ },
74
+ })
69
75
70
76
context := map [string ]interface {}{
71
77
"crypto_key_name" : "tftest-shared-key-1" ,
@@ -111,15 +117,9 @@ data "google_kms_crypto_key_version" "test_key" {
111
117
crypto_key = data.google_kms_crypto_key.cryptokey.id
112
118
}
113
119
114
- resource "google_service_account" "service_account" {
115
- account_id = "tf-test-service-acc%{random_suffix}"
116
- display_name = "Service Account"
117
- }
118
-
119
120
resource "google_integrations_client" "example" {
120
121
location = "us-east1"
121
122
create_sample_integrations = true
122
- run_as_service_account = google_service_account.service_account.email
123
123
cloud_kms_config {
124
124
kms_location = "us-east1"
125
125
kms_ring = basename(data.google_kms_key_ring.keyring.id)
@@ -131,6 +131,48 @@ resource "google_integrations_client" "example" {
131
131
` , context )
132
132
}
133
133
134
+ func TestAccIntegrationsClient_integrationsClientServiceAccountExample (t * testing.T ) {
135
+ t .Parallel ()
136
+
137
+ context := map [string ]interface {}{
138
+ "random_suffix" : acctest .RandString (t , 10 ),
139
+ }
140
+
141
+ acctest .VcrTest (t , resource.TestCase {
142
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
143
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
144
+ CheckDestroy : testAccCheckIntegrationsClientDestroyProducer (t ),
145
+ Steps : []resource.TestStep {
146
+ {
147
+ Config : testAccIntegrationsClient_integrationsClientServiceAccountExample (context ),
148
+ },
149
+ {
150
+ ResourceName : "google_integrations_client.example" ,
151
+ ImportState : true ,
152
+ ImportStateVerify : true ,
153
+ ImportStateVerifyIgnore : []string {"cloud_kms_config" , "create_sample_integrations" , "location" , "run_as_service_account" },
154
+ },
155
+ },
156
+ })
157
+ }
158
+
159
+ func testAccIntegrationsClient_integrationsClientServiceAccountExample (context map [string ]interface {}) string {
160
+ return acctest .Nprintf (`
161
+ data "google_project" "default" {
162
+ }
163
+
164
+ resource "google_service_account" "service_account" {
165
+ account_id = "tf-test-service-acc%{random_suffix}"
166
+ display_name = "Service Account"
167
+ }
168
+
169
+ resource "google_integrations_client" "example" {
170
+ location = "asia-east1"
171
+ run_as_service_account = google_service_account.service_account.email
172
+ }
173
+ ` , context )
174
+ }
175
+
134
176
func testAccCheckIntegrationsClientDestroyProducer (t * testing.T ) func (s * terraform.State ) error {
135
177
return func (s * terraform.State ) error {
136
178
for name , rs := range s .RootModule ().Resources {
0 commit comments