Skip to content

Commit 5d548a3

Browse files
Promote healthcare consent API to GA support (#4393) (#3050)
Co-authored-by: Scott Suarez <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Scott Suarez <[email protected]>
1 parent 41e3cff commit 5d548a3

File tree

6 files changed

+63
-78
lines changed

6 files changed

+63
-78
lines changed

.changelog/4393.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
Promote `google_healthcare_consent_store*` to GA support
3+
```

google-beta/iam_healthcare_consent_store_generated_test.go

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package google
1616

1717
import (
18+
"fmt"
1819
"testing"
1920

2021
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -30,15 +31,27 @@ func TestAccHealthcareConsentStoreIamBindingGenerated(t *testing.T) {
3031

3132
vcrTest(t, resource.TestCase{
3233
PreCheck: func() { testAccPreCheck(t) },
33-
Providers: testAccProvidersOiCS,
34+
Providers: testAccProviders,
3435
Steps: []resource.TestStep{
3536
{
3637
Config: testAccHealthcareConsentStoreIamBinding_basicGenerated(context),
3738
},
39+
{
40+
ResourceName: "google_healthcare_consent_store_iam_binding.foo",
41+
ImportStateId: fmt.Sprintf("%s/consentStores/%s roles/viewer", fmt.Sprintf("projects/%s/locations/%s/datasets/tf-test-my-dataset%s", getTestProjectFromEnv(), getTestRegionFromEnv(), context["random_suffix"]), fmt.Sprintf("tf-test-my-consent-store%s", context["random_suffix"])),
42+
ImportState: true,
43+
ImportStateVerify: true,
44+
},
3845
{
3946
// Test Iam Binding update
4047
Config: testAccHealthcareConsentStoreIamBinding_updateGenerated(context),
4148
},
49+
{
50+
ResourceName: "google_healthcare_consent_store_iam_binding.foo",
51+
ImportStateId: fmt.Sprintf("%s/consentStores/%s roles/viewer", fmt.Sprintf("projects/%s/locations/%s/datasets/tf-test-my-dataset%s", getTestProjectFromEnv(), getTestRegionFromEnv(), context["random_suffix"]), fmt.Sprintf("tf-test-my-consent-store%s", context["random_suffix"])),
52+
ImportState: true,
53+
ImportStateVerify: true,
54+
},
4255
},
4356
})
4457
}
@@ -53,12 +66,18 @@ func TestAccHealthcareConsentStoreIamMemberGenerated(t *testing.T) {
5366

5467
vcrTest(t, resource.TestCase{
5568
PreCheck: func() { testAccPreCheck(t) },
56-
Providers: testAccProvidersOiCS,
69+
Providers: testAccProviders,
5770
Steps: []resource.TestStep{
5871
{
5972
// Test Iam Member creation (no update for member, no need to test)
6073
Config: testAccHealthcareConsentStoreIamMember_basicGenerated(context),
6174
},
75+
{
76+
ResourceName: "google_healthcare_consent_store_iam_member.foo",
77+
ImportStateId: fmt.Sprintf("%s/consentStores/%s roles/viewer user:[email protected]", fmt.Sprintf("projects/%s/locations/%s/datasets/tf-test-my-dataset%s", getTestProjectFromEnv(), getTestRegionFromEnv(), context["random_suffix"]), fmt.Sprintf("tf-test-my-consent-store%s", context["random_suffix"])),
78+
ImportState: true,
79+
ImportStateVerify: true,
80+
},
6281
},
6382
})
6483
}
@@ -73,36 +92,43 @@ func TestAccHealthcareConsentStoreIamPolicyGenerated(t *testing.T) {
7392

7493
vcrTest(t, resource.TestCase{
7594
PreCheck: func() { testAccPreCheck(t) },
76-
Providers: testAccProvidersOiCS,
95+
Providers: testAccProviders,
7796
Steps: []resource.TestStep{
7897
{
7998
Config: testAccHealthcareConsentStoreIamPolicy_basicGenerated(context),
8099
},
100+
{
101+
ResourceName: "google_healthcare_consent_store_iam_policy.foo",
102+
ImportStateId: fmt.Sprintf("%s/consentStores/%s", fmt.Sprintf("projects/%s/locations/%s/datasets/tf-test-my-dataset%s", getTestProjectFromEnv(), getTestRegionFromEnv(), context["random_suffix"]), fmt.Sprintf("tf-test-my-consent-store%s", context["random_suffix"])),
103+
ImportState: true,
104+
ImportStateVerify: true,
105+
},
81106
{
82107
Config: testAccHealthcareConsentStoreIamPolicy_emptyBinding(context),
83108
},
109+
{
110+
ResourceName: "google_healthcare_consent_store_iam_policy.foo",
111+
ImportStateId: fmt.Sprintf("%s/consentStores/%s", fmt.Sprintf("projects/%s/locations/%s/datasets/tf-test-my-dataset%s", getTestProjectFromEnv(), getTestRegionFromEnv(), context["random_suffix"]), fmt.Sprintf("tf-test-my-consent-store%s", context["random_suffix"])),
112+
ImportState: true,
113+
ImportStateVerify: true,
114+
},
84115
},
85116
})
86117
}
87118

88119
func testAccHealthcareConsentStoreIamMember_basicGenerated(context map[string]interface{}) string {
89120
return Nprintf(`
90121
resource "google_healthcare_dataset" "dataset" {
91-
provider = google-beta
92-
93122
location = "us-central1"
94123
name = "tf-test-my-dataset%{random_suffix}"
95124
}
96125
97126
resource "google_healthcare_consent_store" "my-consent" {
98-
provider = google-beta
99-
100127
dataset = google_healthcare_dataset.dataset.id
101128
name = "tf-test-my-consent-store%{random_suffix}"
102129
}
103130
104131
resource "google_healthcare_consent_store_iam_member" "foo" {
105-
provider = google-beta
106132
dataset = google_healthcare_consent_store.my-consent.dataset
107133
consent_store_id = google_healthcare_consent_store.my-consent.name
108134
role = "%{role}"
@@ -114,29 +140,23 @@ resource "google_healthcare_consent_store_iam_member" "foo" {
114140
func testAccHealthcareConsentStoreIamPolicy_basicGenerated(context map[string]interface{}) string {
115141
return Nprintf(`
116142
resource "google_healthcare_dataset" "dataset" {
117-
provider = google-beta
118-
119143
location = "us-central1"
120144
name = "tf-test-my-dataset%{random_suffix}"
121145
}
122146
123147
resource "google_healthcare_consent_store" "my-consent" {
124-
provider = google-beta
125-
126148
dataset = google_healthcare_dataset.dataset.id
127149
name = "tf-test-my-consent-store%{random_suffix}"
128150
}
129151
130152
data "google_iam_policy" "foo" {
131-
provider = google-beta
132153
binding {
133154
role = "%{role}"
134155
members = ["user:[email protected]"]
135156
}
136157
}
137158
138159
resource "google_healthcare_consent_store_iam_policy" "foo" {
139-
provider = google-beta
140160
dataset = google_healthcare_consent_store.my-consent.dataset
141161
consent_store_id = google_healthcare_consent_store.my-consent.name
142162
policy_data = data.google_iam_policy.foo.policy_data
@@ -147,25 +167,19 @@ resource "google_healthcare_consent_store_iam_policy" "foo" {
147167
func testAccHealthcareConsentStoreIamPolicy_emptyBinding(context map[string]interface{}) string {
148168
return Nprintf(`
149169
resource "google_healthcare_dataset" "dataset" {
150-
provider = google-beta
151-
152170
location = "us-central1"
153171
name = "tf-test-my-dataset%{random_suffix}"
154172
}
155173
156174
resource "google_healthcare_consent_store" "my-consent" {
157-
provider = google-beta
158-
159175
dataset = google_healthcare_dataset.dataset.id
160176
name = "tf-test-my-consent-store%{random_suffix}"
161177
}
162178
163179
data "google_iam_policy" "foo" {
164-
provider = google-beta
165180
}
166181
167182
resource "google_healthcare_consent_store_iam_policy" "foo" {
168-
provider = google-beta
169183
dataset = google_healthcare_consent_store.my-consent.dataset
170184
consent_store_id = google_healthcare_consent_store.my-consent.name
171185
policy_data = data.google_iam_policy.foo.policy_data
@@ -176,21 +190,16 @@ resource "google_healthcare_consent_store_iam_policy" "foo" {
176190
func testAccHealthcareConsentStoreIamBinding_basicGenerated(context map[string]interface{}) string {
177191
return Nprintf(`
178192
resource "google_healthcare_dataset" "dataset" {
179-
provider = google-beta
180-
181193
location = "us-central1"
182194
name = "tf-test-my-dataset%{random_suffix}"
183195
}
184196
185197
resource "google_healthcare_consent_store" "my-consent" {
186-
provider = google-beta
187-
188198
dataset = google_healthcare_dataset.dataset.id
189199
name = "tf-test-my-consent-store%{random_suffix}"
190200
}
191201
192202
resource "google_healthcare_consent_store_iam_binding" "foo" {
193-
provider = google-beta
194203
dataset = google_healthcare_consent_store.my-consent.dataset
195204
consent_store_id = google_healthcare_consent_store.my-consent.name
196205
role = "%{role}"
@@ -202,21 +211,16 @@ resource "google_healthcare_consent_store_iam_binding" "foo" {
202211
func testAccHealthcareConsentStoreIamBinding_updateGenerated(context map[string]interface{}) string {
203212
return Nprintf(`
204213
resource "google_healthcare_dataset" "dataset" {
205-
provider = google-beta
206-
207214
location = "us-central1"
208215
name = "tf-test-my-dataset%{random_suffix}"
209216
}
210217
211218
resource "google_healthcare_consent_store" "my-consent" {
212-
provider = google-beta
213-
214219
dataset = google_healthcare_dataset.dataset.id
215220
name = "tf-test-my-consent-store%{random_suffix}"
216221
}
217222
218223
resource "google_healthcare_consent_store_iam_binding" "foo" {
219-
provider = google-beta
220224
dataset = google_healthcare_consent_store.my-consent.dataset
221225
consent_store_id = google_healthcare_consent_store.my-consent.name
222226
role = "%{role}"

google-beta/resource_healthcare_consent_store.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam
6767
"enable_consent_create_on_update": {
6868
Type: schema.TypeBool,
6969
Optional: true,
70-
Description: `If true, [consents.patch] [google.cloud.healthcare.v1beta1.consent.UpdateConsent] creates the consent if it does not already exist.`,
70+
Description: `If true, [consents.patch] [google.cloud.healthcare.v1.consent.UpdateConsent] creates the consent if it does not already exist.`,
7171
},
7272
"labels": {
7373
Type: schema.TypeMap,
@@ -290,9 +290,7 @@ func resourceHealthcareConsentStoreDelete(d *schema.ResourceData, meta interface
290290
func resourceHealthcareConsentStoreImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
291291
config := meta.(*Config)
292292
if err := parseImportId([]string{
293-
"(?P<dataset>[^/]+)/consentStores/(?P<name>[^/]+)",
294-
"(?P<dataset>[^/]+)/(?P<name>[^/]+)",
295-
"(?P<name>[^/]+)",
293+
"(?P<dataset>.+)/consentStores/(?P<name>[^/]+)",
296294
}, d, config); err != nil {
297295
return nil, err
298296
}

google-beta/resource_healthcare_consent_store_generated_test.go

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreBasicExample(t *testing
3232

3333
vcrTest(t, resource.TestCase{
3434
PreCheck: func() { testAccPreCheck(t) },
35-
Providers: testAccProvidersOiCS,
35+
Providers: testAccProviders,
3636
ExternalProviders: map[string]resource.ExternalProvider{
3737
"random": {},
3838
},
@@ -41,22 +41,24 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreBasicExample(t *testing
4141
{
4242
Config: testAccHealthcareConsentStore_healthcareConsentStoreBasicExample(context),
4343
},
44+
{
45+
ResourceName: "google_healthcare_consent_store.my-consent",
46+
ImportState: true,
47+
ImportStateVerify: true,
48+
ImportStateVerifyIgnore: []string{"name", "dataset"},
49+
},
4450
},
4551
})
4652
}
4753

4854
func testAccHealthcareConsentStore_healthcareConsentStoreBasicExample(context map[string]interface{}) string {
4955
return Nprintf(`
5056
resource "google_healthcare_dataset" "dataset" {
51-
provider = google-beta
52-
5357
location = "us-central1"
5458
name = "tf-test-my-dataset%{random_suffix}"
5559
}
5660
5761
resource "google_healthcare_consent_store" "my-consent" {
58-
provider = google-beta
59-
6062
dataset = google_healthcare_dataset.dataset.id
6163
name = "tf-test-my-consent-store%{random_suffix}"
6264
}
@@ -72,7 +74,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreFullExample(t *testing.
7274

7375
vcrTest(t, resource.TestCase{
7476
PreCheck: func() { testAccPreCheck(t) },
75-
Providers: testAccProvidersOiCS,
77+
Providers: testAccProviders,
7678
ExternalProviders: map[string]resource.ExternalProvider{
7779
"random": {},
7880
},
@@ -81,6 +83,12 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreFullExample(t *testing.
8183
{
8284
Config: testAccHealthcareConsentStore_healthcareConsentStoreFullExample(context),
8385
},
86+
{
87+
ResourceName: "google_healthcare_consent_store.my-consent",
88+
ImportState: true,
89+
ImportStateVerify: true,
90+
ImportStateVerifyIgnore: []string{"name", "dataset"},
91+
},
8492
},
8593
})
8694
}
@@ -89,15 +97,11 @@ func testAccHealthcareConsentStore_healthcareConsentStoreFullExample(context map
8997
return Nprintf(`
9098
9199
resource "google_healthcare_dataset" "dataset" {
92-
provider = google-beta
93-
94100
location = "us-central1"
95101
name = "tf-test-my-dataset%{random_suffix}"
96102
}
97103
98104
resource "google_healthcare_consent_store" "my-consent" {
99-
provider = google-beta
100-
101105
dataset = google_healthcare_dataset.dataset.id
102106
name = "tf-test-my-consent-store%{random_suffix}"
103107
@@ -120,7 +124,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreIamExample(t *testing.T
120124

121125
vcrTest(t, resource.TestCase{
122126
PreCheck: func() { testAccPreCheck(t) },
123-
Providers: testAccProvidersOiCS,
127+
Providers: testAccProviders,
124128
ExternalProviders: map[string]resource.ExternalProvider{
125129
"random": {},
126130
},
@@ -129,36 +133,34 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreIamExample(t *testing.T
129133
{
130134
Config: testAccHealthcareConsentStore_healthcareConsentStoreIamExample(context),
131135
},
136+
{
137+
ResourceName: "google_healthcare_consent_store.my-consent",
138+
ImportState: true,
139+
ImportStateVerify: true,
140+
ImportStateVerifyIgnore: []string{"name", "dataset"},
141+
},
132142
},
133143
})
134144
}
135145

136146
func testAccHealthcareConsentStore_healthcareConsentStoreIamExample(context map[string]interface{}) string {
137147
return Nprintf(`
138148
resource "google_healthcare_dataset" "dataset" {
139-
provider = google-beta
140-
141149
location = "us-central1"
142150
name = "tf-test-my-dataset%{random_suffix}"
143151
}
144152
145153
resource "google_healthcare_consent_store" "my-consent" {
146-
provider = google-beta
147-
148154
dataset = google_healthcare_dataset.dataset.id
149155
name = "tf-test-my-consent-store%{random_suffix}"
150156
}
151157
152158
resource "google_service_account" "test-account" {
153-
provider = google-beta
154-
155159
account_id = "tf-test-my-account%{random_suffix}"
156160
display_name = "Test Service Account"
157161
}
158162
159163
resource "google_healthcare_consent_store_iam_member" "test-iam" {
160-
provider = google-beta
161-
162164
dataset = google_healthcare_dataset.dataset.id
163165
consent_store_id = google_healthcare_consent_store.my-consent.name
164166
role = "roles/editor"

0 commit comments

Comments
 (0)