Skip to content

Commit 0a754aa

Browse files
Deprecate run_as_service_account field in client (#13583) (#22312)
[upstream:eff696154c90353a650bef5a0f242cf76cf68212] Signed-off-by: Modular Magician <[email protected]>
1 parent 0995775 commit 0a754aa

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

.changelog/13583.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:deprecation
2+
integrations: deprecated `run_as_service_account` field in `google_integrations_client` resource
3+
```

google/services/integrations/resource_integrations_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ encrypted with GMEK.`,
119119
"run_as_service_account": {
120120
Type: schema.TypeString,
121121
Optional: true,
122+
Deprecated: "`run_as_service_account` is deprecated and will be removed in a future major release.",
122123
ForceNew: true,
123124
Description: `User input run-as service account, if empty, will bring up a new default service account.`,
124125
},

google/services/integrations/resource_integrations_client_generated_test.go

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ resource "google_integrations_client" "example" {
6666
func TestAccIntegrationsClient_integrationsClientFullExample(t *testing.T) {
6767
acctest.SkipIfVcr(t)
6868
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+
})
6975

7076
context := map[string]interface{}{
7177
"crypto_key_name": "tftest-shared-key-1",
@@ -111,15 +117,9 @@ data "google_kms_crypto_key_version" "test_key" {
111117
crypto_key = data.google_kms_crypto_key.cryptokey.id
112118
}
113119
114-
resource "google_service_account" "service_account" {
115-
account_id = "tf-test-service-acc%{random_suffix}"
116-
display_name = "Service Account"
117-
}
118-
119120
resource "google_integrations_client" "example" {
120121
location = "us-east1"
121122
create_sample_integrations = true
122-
run_as_service_account = google_service_account.service_account.email
123123
cloud_kms_config {
124124
kms_location = "us-east1"
125125
kms_ring = basename(data.google_kms_key_ring.keyring.id)
@@ -131,6 +131,48 @@ resource "google_integrations_client" "example" {
131131
`, context)
132132
}
133133

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+
134176
func testAccCheckIntegrationsClientDestroyProducer(t *testing.T) func(s *terraform.State) error {
135177
return func(s *terraform.State) error {
136178
for name, rs := range s.RootModule().Resources {

website/docs/r/integrations_client.html.markdown

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,9 @@ data "google_kms_crypto_key_version" "test_key" {
7070
crypto_key = data.google_kms_crypto_key.cryptokey.id
7171
}
7272
73-
resource "google_service_account" "service_account" {
74-
account_id = "service-acc"
75-
display_name = "Service Account"
76-
}
77-
7873
resource "google_integrations_client" "example" {
7974
location = "us-east1"
8075
create_sample_integrations = true
81-
run_as_service_account = google_service_account.service_account.email
8276
cloud_kms_config {
8377
kms_location = "us-east1"
8478
kms_ring = basename(data.google_kms_key_ring.keyring.id)
@@ -112,9 +106,11 @@ The following arguments are supported:
112106
Indicates if sample integrations should be created along with provisioning.
113107

114108
* `run_as_service_account` -
115-
(Optional)
109+
(Optional, Deprecated)
116110
User input run-as service account, if empty, will bring up a new default service account.
117111

112+
~> **Warning:** `run_as_service_account` is deprecated and will be removed in a future major release.
113+
118114
* `project` - (Optional) The ID of the project in which the resource belongs.
119115
If it is not provided, the provider project is used.
120116

0 commit comments

Comments
 (0)