Skip to content

Commit 8465d0b

Browse files
modular-magicianChris Stephens
andauthored
Promote healthcare resources to GA (#3377) (#1974)
* add GA healthcare API * add ga resources to website * rename test files * stop skipping hl7 test * Removing erb syntax and GA's utils file * formatting and fixing imports * move client config to GA and cleanup tests Co-authored-by: Chris Stephens <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Chris Stephens <[email protected]>
1 parent b8f81ea commit 8465d0b

13 files changed

+343
-122
lines changed

.changelog/3377.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```release-note:new-resource
2+
`google_healthcare_dataset` is now GA
3+
```
4+
```release-note:new-resource
5+
`google_healthcare_dicom_store` is now GA
6+
```
7+
```release-note:new-resource
8+
`google_healthcare_fhir_store` is now GA
9+
```
10+
```release-note:new-resource
11+
`google_healthcare_hl7_v2_store` is now GA
12+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package google
16+
17+
import (
18+
"fmt"
19+
"strings"
20+
"testing"
21+
22+
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
23+
"github.com/hashicorp/terraform-plugin-sdk/terraform"
24+
)
25+
26+
func TestAccHealthcareDataset_healthcareDatasetBasicExample(t *testing.T) {
27+
t.Parallel()
28+
29+
context := map[string]interface{}{
30+
"random_suffix": randString(t, 10),
31+
}
32+
33+
vcrTest(t, resource.TestCase{
34+
PreCheck: func() { testAccPreCheck(t) },
35+
Providers: testAccProviders,
36+
CheckDestroy: testAccCheckHealthcareDatasetDestroyProducer(t),
37+
Steps: []resource.TestStep{
38+
{
39+
Config: testAccHealthcareDataset_healthcareDatasetBasicExample(context),
40+
},
41+
{
42+
ResourceName: "google_healthcare_dataset.default",
43+
ImportState: true,
44+
ImportStateVerify: true,
45+
ImportStateVerifyIgnore: []string{"self_link", "location"},
46+
},
47+
},
48+
})
49+
}
50+
51+
func testAccHealthcareDataset_healthcareDatasetBasicExample(context map[string]interface{}) string {
52+
return Nprintf(`
53+
resource "google_healthcare_dataset" "default" {
54+
name = "tf-test-example-dataset%{random_suffix}"
55+
location = "us-central1"
56+
time_zone = "UTC"
57+
}
58+
`, context)
59+
}
60+
61+
func testAccCheckHealthcareDatasetDestroyProducer(t *testing.T) func(s *terraform.State) error {
62+
return func(s *terraform.State) error {
63+
for name, rs := range s.RootModule().Resources {
64+
if rs.Type != "google_healthcare_dataset" {
65+
continue
66+
}
67+
if strings.HasPrefix(name, "data.") {
68+
continue
69+
}
70+
71+
config := googleProviderConfig(t)
72+
73+
url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}projects/{{project}}/locations/{{location}}/datasets/{{name}}")
74+
if err != nil {
75+
return err
76+
}
77+
78+
_, err = sendRequest(config, "GET", "", url, nil)
79+
if err == nil {
80+
return fmt.Errorf("HealthcareDataset still exists at %s", url)
81+
}
82+
}
83+
84+
return nil
85+
}
86+
}

google-beta/resource_healthcare_dataset_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package google
22

33
import (
44
"fmt"
5-
"strings"
65
"testing"
76

87
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
@@ -105,33 +104,6 @@ func TestAccHealthcareDataset_basic(t *testing.T) {
105104
})
106105
}
107106

108-
func testAccCheckHealthcareDatasetDestroyProducer(t *testing.T) func(s *terraform.State) error {
109-
return func(s *terraform.State) error {
110-
for name, rs := range s.RootModule().Resources {
111-
if rs.Type != "google_healthcare_dataset" {
112-
continue
113-
}
114-
if strings.HasPrefix(name, "data.") {
115-
continue
116-
}
117-
118-
config := googleProviderConfig(t)
119-
120-
url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}projects/{{project}}/locations/{{location}}/datasets/{{name}}")
121-
if err != nil {
122-
return err
123-
}
124-
125-
_, err = sendRequest(config, "GET", "", url, nil)
126-
if err == nil {
127-
return fmt.Errorf("HealthcareDataset still exists at %s", url)
128-
}
129-
}
130-
131-
return nil
132-
}
133-
}
134-
135107
func testAccCheckGoogleHealthcareDatasetUpdate(t *testing.T, timeZone string) resource.TestCheckFunc {
136108
return func(s *terraform.State) error {
137109
for _, rs := range s.RootModule().Resources {
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package google
16+
17+
import (
18+
"fmt"
19+
"strings"
20+
"testing"
21+
22+
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
23+
"github.com/hashicorp/terraform-plugin-sdk/terraform"
24+
)
25+
26+
func TestAccHealthcareDicomStore_healthcareDicomStoreBasicExample(t *testing.T) {
27+
t.Parallel()
28+
29+
context := map[string]interface{}{
30+
"random_suffix": randString(t, 10),
31+
}
32+
33+
vcrTest(t, resource.TestCase{
34+
PreCheck: func() { testAccPreCheck(t) },
35+
Providers: testAccProviders,
36+
CheckDestroy: testAccCheckHealthcareDicomStoreDestroyProducer(t),
37+
Steps: []resource.TestStep{
38+
{
39+
Config: testAccHealthcareDicomStore_healthcareDicomStoreBasicExample(context),
40+
},
41+
{
42+
ResourceName: "google_healthcare_dicom_store.default",
43+
ImportState: true,
44+
ImportStateVerify: true,
45+
ImportStateVerifyIgnore: []string{"self_link", "dataset"},
46+
},
47+
},
48+
})
49+
}
50+
51+
func testAccHealthcareDicomStore_healthcareDicomStoreBasicExample(context map[string]interface{}) string {
52+
return Nprintf(`
53+
resource "google_healthcare_dicom_store" "default" {
54+
name = "tf-test-example-dicom-store%{random_suffix}"
55+
dataset = google_healthcare_dataset.dataset.id
56+
57+
notification_config {
58+
pubsub_topic = google_pubsub_topic.topic.id
59+
}
60+
61+
labels = {
62+
label1 = "labelvalue1"
63+
}
64+
}
65+
66+
resource "google_pubsub_topic" "topic" {
67+
name = "tf-test-dicom-notifications%{random_suffix}"
68+
}
69+
70+
resource "google_healthcare_dataset" "dataset" {
71+
name = "tf-test-example-dataset%{random_suffix}"
72+
location = "us-central1"
73+
}
74+
`, context)
75+
}
76+
77+
func testAccCheckHealthcareDicomStoreDestroyProducer(t *testing.T) func(s *terraform.State) error {
78+
return func(s *terraform.State) error {
79+
for name, rs := range s.RootModule().Resources {
80+
if rs.Type != "google_healthcare_dicom_store" {
81+
continue
82+
}
83+
if strings.HasPrefix(name, "data.") {
84+
continue
85+
}
86+
87+
config := googleProviderConfig(t)
88+
89+
url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}{{dataset}}/dicomStores/{{name}}")
90+
if err != nil {
91+
return err
92+
}
93+
94+
_, err = sendRequest(config, "GET", "", url, nil)
95+
if err == nil {
96+
return fmt.Errorf("HealthcareDicomStore still exists at %s", url)
97+
}
98+
}
99+
100+
return nil
101+
}
102+
}

google-beta/resource_healthcare_dicom_store_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package google
33
import (
44
"fmt"
55
"path"
6-
"strings"
76
"testing"
87

98
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
@@ -155,33 +154,6 @@ resource "google_pubsub_topic" "topic" {
155154
`, dicomStoreName, datasetName, pubsubTopic)
156155
}
157156

158-
func testAccCheckHealthcareDicomStoreDestroyProducer(t *testing.T) func(s *terraform.State) error {
159-
return func(s *terraform.State) error {
160-
for name, rs := range s.RootModule().Resources {
161-
if rs.Type != "google_healthcare_dicom_store" {
162-
continue
163-
}
164-
if strings.HasPrefix(name, "data.") {
165-
continue
166-
}
167-
168-
config := googleProviderConfig(t)
169-
170-
url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}{{dataset}}/dicomStores/{{name}}")
171-
if err != nil {
172-
return err
173-
}
174-
175-
_, err = sendRequest(config, "GET", "", url, nil)
176-
if err == nil {
177-
return fmt.Errorf("HealthcareDicomStore still exists at %s", url)
178-
}
179-
}
180-
181-
return nil
182-
}
183-
}
184-
185157
func testAccCheckGoogleHealthcareDicomStoreUpdate(t *testing.T, pubsubTopic string) resource.TestCheckFunc {
186158
return func(s *terraform.State) error {
187159
var foundResource = false
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package google
16+
17+
import (
18+
"fmt"
19+
"strings"
20+
"testing"
21+
22+
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
23+
"github.com/hashicorp/terraform-plugin-sdk/terraform"
24+
)
25+
26+
func TestAccHealthcareFhirStore_healthcareFhirStoreBasicExample(t *testing.T) {
27+
t.Parallel()
28+
29+
context := map[string]interface{}{
30+
"random_suffix": randString(t, 10),
31+
}
32+
33+
vcrTest(t, resource.TestCase{
34+
PreCheck: func() { testAccPreCheck(t) },
35+
Providers: testAccProviders,
36+
CheckDestroy: testAccCheckHealthcareFhirStoreDestroyProducer(t),
37+
Steps: []resource.TestStep{
38+
{
39+
Config: testAccHealthcareFhirStore_healthcareFhirStoreBasicExample(context),
40+
},
41+
{
42+
ResourceName: "google_healthcare_fhir_store.default",
43+
ImportState: true,
44+
ImportStateVerify: true,
45+
ImportStateVerifyIgnore: []string{"self_link", "dataset"},
46+
},
47+
},
48+
})
49+
}
50+
51+
func testAccHealthcareFhirStore_healthcareFhirStoreBasicExample(context map[string]interface{}) string {
52+
return Nprintf(`
53+
resource "google_healthcare_fhir_store" "default" {
54+
name = "tf-test-example-fhir-store%{random_suffix}"
55+
dataset = google_healthcare_dataset.dataset.id
56+
version = "R4"
57+
58+
enable_update_create = false
59+
disable_referential_integrity = false
60+
disable_resource_versioning = false
61+
enable_history_import = false
62+
63+
notification_config {
64+
pubsub_topic = google_pubsub_topic.topic.id
65+
}
66+
67+
labels = {
68+
label1 = "labelvalue1"
69+
}
70+
}
71+
72+
resource "google_pubsub_topic" "topic" {
73+
name = "tf-test-fhir-notifications%{random_suffix}"
74+
}
75+
76+
resource "google_healthcare_dataset" "dataset" {
77+
name = "tf-test-example-dataset%{random_suffix}"
78+
location = "us-central1"
79+
}
80+
`, context)
81+
}
82+
83+
func testAccCheckHealthcareFhirStoreDestroyProducer(t *testing.T) func(s *terraform.State) error {
84+
return func(s *terraform.State) error {
85+
for name, rs := range s.RootModule().Resources {
86+
if rs.Type != "google_healthcare_fhir_store" {
87+
continue
88+
}
89+
if strings.HasPrefix(name, "data.") {
90+
continue
91+
}
92+
93+
config := googleProviderConfig(t)
94+
95+
url, err := replaceVarsForTest(config, rs, "{{HealthcareBasePath}}{{dataset}}/fhirStores/{{name}}")
96+
if err != nil {
97+
return err
98+
}
99+
100+
_, err = sendRequest(config, "GET", "", url, nil)
101+
if err == nil {
102+
return fmt.Errorf("HealthcareFhirStore still exists at %s", url)
103+
}
104+
}
105+
106+
return nil
107+
}
108+
}

0 commit comments

Comments
 (0)