forked from hashicorp/terraform-provider-google-beta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Promote healthcare consent API to GA support (hashicorp#4393) (hashic…
…orp#3050) Co-authored-by: Scott Suarez <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Scott Suarez <[email protected]>
- Loading branch information
1 parent
41e3cff
commit 5d548a3
Showing
6 changed files
with
63 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
Promote `google_healthcare_consent_store*` to GA support | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
package google | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
@@ -30,15 +31,27 @@ func TestAccHealthcareConsentStoreIamBindingGenerated(t *testing.T) { | |
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProvidersOiCS, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccHealthcareConsentStoreIamBinding_basicGenerated(context), | ||
}, | ||
{ | ||
ResourceName: "google_healthcare_consent_store_iam_binding.foo", | ||
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"])), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
// Test Iam Binding update | ||
Config: testAccHealthcareConsentStoreIamBinding_updateGenerated(context), | ||
}, | ||
{ | ||
ResourceName: "google_healthcare_consent_store_iam_binding.foo", | ||
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"])), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
@@ -53,12 +66,18 @@ func TestAccHealthcareConsentStoreIamMemberGenerated(t *testing.T) { | |
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProvidersOiCS, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
// Test Iam Member creation (no update for member, no need to test) | ||
Config: testAccHealthcareConsentStoreIamMember_basicGenerated(context), | ||
}, | ||
{ | ||
ResourceName: "google_healthcare_consent_store_iam_member.foo", | ||
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"])), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
@@ -73,36 +92,43 @@ func TestAccHealthcareConsentStoreIamPolicyGenerated(t *testing.T) { | |
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProvidersOiCS, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccHealthcareConsentStoreIamPolicy_basicGenerated(context), | ||
}, | ||
{ | ||
ResourceName: "google_healthcare_consent_store_iam_policy.foo", | ||
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"])), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccHealthcareConsentStoreIamPolicy_emptyBinding(context), | ||
}, | ||
{ | ||
ResourceName: "google_healthcare_consent_store_iam_policy.foo", | ||
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"])), | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccHealthcareConsentStoreIamMember_basicGenerated(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_healthcare_dataset" "dataset" { | ||
provider = google-beta | ||
location = "us-central1" | ||
name = "tf-test-my-dataset%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store" "my-consent" { | ||
provider = google-beta | ||
dataset = google_healthcare_dataset.dataset.id | ||
name = "tf-test-my-consent-store%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store_iam_member" "foo" { | ||
provider = google-beta | ||
dataset = google_healthcare_consent_store.my-consent.dataset | ||
consent_store_id = google_healthcare_consent_store.my-consent.name | ||
role = "%{role}" | ||
|
@@ -114,29 +140,23 @@ resource "google_healthcare_consent_store_iam_member" "foo" { | |
func testAccHealthcareConsentStoreIamPolicy_basicGenerated(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_healthcare_dataset" "dataset" { | ||
provider = google-beta | ||
location = "us-central1" | ||
name = "tf-test-my-dataset%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store" "my-consent" { | ||
provider = google-beta | ||
dataset = google_healthcare_dataset.dataset.id | ||
name = "tf-test-my-consent-store%{random_suffix}" | ||
} | ||
data "google_iam_policy" "foo" { | ||
provider = google-beta | ||
binding { | ||
role = "%{role}" | ||
members = ["user:[email protected]"] | ||
} | ||
} | ||
resource "google_healthcare_consent_store_iam_policy" "foo" { | ||
provider = google-beta | ||
dataset = google_healthcare_consent_store.my-consent.dataset | ||
consent_store_id = google_healthcare_consent_store.my-consent.name | ||
policy_data = data.google_iam_policy.foo.policy_data | ||
|
@@ -147,25 +167,19 @@ resource "google_healthcare_consent_store_iam_policy" "foo" { | |
func testAccHealthcareConsentStoreIamPolicy_emptyBinding(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_healthcare_dataset" "dataset" { | ||
provider = google-beta | ||
location = "us-central1" | ||
name = "tf-test-my-dataset%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store" "my-consent" { | ||
provider = google-beta | ||
dataset = google_healthcare_dataset.dataset.id | ||
name = "tf-test-my-consent-store%{random_suffix}" | ||
} | ||
data "google_iam_policy" "foo" { | ||
provider = google-beta | ||
} | ||
resource "google_healthcare_consent_store_iam_policy" "foo" { | ||
provider = google-beta | ||
dataset = google_healthcare_consent_store.my-consent.dataset | ||
consent_store_id = google_healthcare_consent_store.my-consent.name | ||
policy_data = data.google_iam_policy.foo.policy_data | ||
|
@@ -176,21 +190,16 @@ resource "google_healthcare_consent_store_iam_policy" "foo" { | |
func testAccHealthcareConsentStoreIamBinding_basicGenerated(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_healthcare_dataset" "dataset" { | ||
provider = google-beta | ||
location = "us-central1" | ||
name = "tf-test-my-dataset%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store" "my-consent" { | ||
provider = google-beta | ||
dataset = google_healthcare_dataset.dataset.id | ||
name = "tf-test-my-consent-store%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store_iam_binding" "foo" { | ||
provider = google-beta | ||
dataset = google_healthcare_consent_store.my-consent.dataset | ||
consent_store_id = google_healthcare_consent_store.my-consent.name | ||
role = "%{role}" | ||
|
@@ -202,21 +211,16 @@ resource "google_healthcare_consent_store_iam_binding" "foo" { | |
func testAccHealthcareConsentStoreIamBinding_updateGenerated(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_healthcare_dataset" "dataset" { | ||
provider = google-beta | ||
location = "us-central1" | ||
name = "tf-test-my-dataset%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store" "my-consent" { | ||
provider = google-beta | ||
dataset = google_healthcare_dataset.dataset.id | ||
name = "tf-test-my-consent-store%{random_suffix}" | ||
} | ||
resource "google_healthcare_consent_store_iam_binding" "foo" { | ||
provider = google-beta | ||
dataset = google_healthcare_consent_store.my-consent.dataset | ||
consent_store_id = google_healthcare_consent_store.my-consent.name | ||
role = "%{role}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.