@@ -113,6 +113,38 @@ func TestAccHealthcareHl7V2Store_basic(t *testing.T) {
113113 })
114114}
115115
116+ func TestAccHealthcareHl7V2Store_updateSchema (t * testing.T ) {
117+ t .Parallel ()
118+
119+ datasetName := fmt .Sprintf ("tf-test-dataset-%s" , randString (t , 10 ))
120+ hl7_v2StoreName := fmt .Sprintf ("tf-test-hl7_v2-store-%s" , randString (t , 10 ))
121+ resourceName := "google_healthcare_hl7_v2_store.default"
122+
123+ vcrTest (t , resource.TestCase {
124+ PreCheck : func () { testAccPreCheck (t ) },
125+ Providers : testAccProvidersOiCS ,
126+ CheckDestroy : testAccCheckHealthcareHl7V2StoreDestroyProducer (t ),
127+ Steps : []resource.TestStep {
128+ {
129+ Config : testGoogleHealthcareHl7V2Store_basicSchema (hl7_v2StoreName , datasetName ),
130+ },
131+ {
132+ ResourceName : resourceName ,
133+ ImportState : true ,
134+ ImportStateVerify : true ,
135+ },
136+ {
137+ Config : testGoogleHealthcareHl7V2Store_updateSchema (hl7_v2StoreName , datasetName ),
138+ },
139+ {
140+ ResourceName : resourceName ,
141+ ImportState : true ,
142+ ImportStateVerify : true ,
143+ },
144+ },
145+ })
146+ }
147+
116148func testGoogleHealthcareHl7V2Store_basic (hl7_v2StoreName , datasetName string ) string {
117149 return fmt .Sprintf (`
118150resource "google_healthcare_hl7_v2_store" "default" {
@@ -158,6 +190,59 @@ resource "google_pubsub_topic" "topic" {
158190` , hl7_v2StoreName , datasetName , pubsubTopic )
159191}
160192
193+ func testGoogleHealthcareHl7V2Store_basicSchema (hl7_v2StoreName , datasetName string ) string {
194+ return fmt .Sprintf (`
195+ resource "google_healthcare_hl7_v2_store" "default" {
196+ provider = google-beta
197+ name = "%s"
198+ dataset = google_healthcare_dataset.dataset.id
199+
200+ parser_config {
201+ schema = <<EOF
202+ {
203+ "schematizedParsingType": "SOFT_FAIL",
204+ "ignoreMinOccurs": true
205+ }
206+ EOF
207+ version = "V2"
208+ }
209+ }
210+
211+ resource "google_healthcare_dataset" "dataset" {
212+ provider = google-beta
213+ name = "%s"
214+ location = "us-central1"
215+ }
216+ ` , hl7_v2StoreName , datasetName )
217+ }
218+
219+ func testGoogleHealthcareHl7V2Store_updateSchema (hl7_v2StoreName , datasetName string ) string {
220+ return fmt .Sprintf (`
221+ resource "google_healthcare_hl7_v2_store" "default" {
222+ provider = google-beta
223+ name = "%s"
224+ dataset = google_healthcare_dataset.dataset.id
225+
226+ parser_config {
227+ schema = <<EOF
228+ {
229+ "schematizedParsingType": "SOFT_FAIL",
230+ "ignoreMinOccurs": true,
231+ "unexpectedSegmentHandling": "PARSE"
232+ }
233+ EOF
234+ version = "V2"
235+ }
236+ }
237+
238+ resource "google_healthcare_dataset" "dataset" {
239+ provider = google-beta
240+ name = "%s"
241+ location = "us-central1"
242+ }
243+ ` , hl7_v2StoreName , datasetName )
244+ }
245+
161246func testAccCheckGoogleHealthcareHl7V2StoreUpdate (t * testing.T , pubsubTopic string ) resource.TestCheckFunc {
162247 return func (s * terraform.State ) error {
163248 var foundResource = false
0 commit comments