diff --git a/.changelog/4393.txt b/.changelog/4393.txt new file mode 100644 index 0000000000..65c0f617e6 --- /dev/null +++ b/.changelog/4393.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +Promote `google_healthcare_consent_store*` to GA support +``` diff --git a/google-beta/iam_healthcare_consent_store_generated_test.go b/google-beta/iam_healthcare_consent_store_generated_test.go index 20d5a21d79..1edbd8b340 100644 --- a/google-beta/iam_healthcare_consent_store_generated_test.go +++ b/google-beta/iam_healthcare_consent_store_generated_test.go @@ -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:admin@hashicorptest.com", 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,14 +92,26 @@ 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, + }, }, }) } @@ -88,21 +119,16 @@ func TestAccHealthcareConsentStoreIamPolicyGenerated(t *testing.T) { 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,21 +140,16 @@ 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:admin@hashicorptest.com"] @@ -136,7 +157,6 @@ data "google_iam_policy" "foo" { } 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}" diff --git a/google-beta/resource_healthcare_consent_store.go b/google-beta/resource_healthcare_consent_store.go index b8e98f706c..3e65991bd0 100644 --- a/google-beta/resource_healthcare_consent_store.go +++ b/google-beta/resource_healthcare_consent_store.go @@ -67,7 +67,7 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam "enable_consent_create_on_update": { Type: schema.TypeBool, Optional: true, - Description: `If true, [consents.patch] [google.cloud.healthcare.v1beta1.consent.UpdateConsent] creates the consent if it does not already exist.`, + Description: `If true, [consents.patch] [google.cloud.healthcare.v1.consent.UpdateConsent] creates the consent if it does not already exist.`, }, "labels": { Type: schema.TypeMap, @@ -290,9 +290,7 @@ func resourceHealthcareConsentStoreDelete(d *schema.ResourceData, meta interface func resourceHealthcareConsentStoreImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { config := meta.(*Config) if err := parseImportId([]string{ - "(?P[^/]+)/consentStores/(?P[^/]+)", - "(?P[^/]+)/(?P[^/]+)", - "(?P[^/]+)", + "(?P.+)/consentStores/(?P[^/]+)", }, d, config); err != nil { return nil, err } diff --git a/google-beta/resource_healthcare_consent_store_generated_test.go b/google-beta/resource_healthcare_consent_store_generated_test.go index 308011b067..4331f2fc65 100644 --- a/google-beta/resource_healthcare_consent_store_generated_test.go +++ b/google-beta/resource_healthcare_consent_store_generated_test.go @@ -32,7 +32,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreBasicExample(t *testing vcrTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, @@ -41,6 +41,12 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreBasicExample(t *testing { Config: testAccHealthcareConsentStore_healthcareConsentStoreBasicExample(context), }, + { + ResourceName: "google_healthcare_consent_store.my-consent", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "dataset"}, + }, }, }) } @@ -48,15 +54,11 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreBasicExample(t *testing func testAccHealthcareConsentStore_healthcareConsentStoreBasicExample(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}" } @@ -72,7 +74,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreFullExample(t *testing. vcrTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, @@ -81,6 +83,12 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreFullExample(t *testing. { Config: testAccHealthcareConsentStore_healthcareConsentStoreFullExample(context), }, + { + ResourceName: "google_healthcare_consent_store.my-consent", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "dataset"}, + }, }, }) } @@ -89,15 +97,11 @@ func testAccHealthcareConsentStore_healthcareConsentStoreFullExample(context map 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}" @@ -120,7 +124,7 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreIamExample(t *testing.T vcrTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProvidersOiCS, + Providers: testAccProviders, ExternalProviders: map[string]resource.ExternalProvider{ "random": {}, }, @@ -129,6 +133,12 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreIamExample(t *testing.T { Config: testAccHealthcareConsentStore_healthcareConsentStoreIamExample(context), }, + { + ResourceName: "google_healthcare_consent_store.my-consent", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name", "dataset"}, + }, }, }) } @@ -136,29 +146,21 @@ func TestAccHealthcareConsentStore_healthcareConsentStoreIamExample(t *testing.T func testAccHealthcareConsentStore_healthcareConsentStoreIamExample(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_service_account" "test-account" { - provider = google-beta - account_id = "tf-test-my-account%{random_suffix}" display_name = "Test Service Account" } resource "google_healthcare_consent_store_iam_member" "test-iam" { - provider = google-beta - dataset = google_healthcare_dataset.dataset.id consent_store_id = google_healthcare_consent_store.my-consent.name role = "roles/editor" diff --git a/website/docs/r/healthcare_consent_store.html.markdown b/website/docs/r/healthcare_consent_store.html.markdown index b8968558ba..e54411aeee 100644 --- a/website/docs/r/healthcare_consent_store.html.markdown +++ b/website/docs/r/healthcare_consent_store.html.markdown @@ -22,14 +22,12 @@ description: |- # google\_healthcare\_consent\_store -The Consent Management API is a tool for tracking user consents and the documentation associated with the consents. +The Consent Management API is a tool for tracking user consents and the documentation associated with the consents. -~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. To get more information about ConsentStore, see: -* [API documentation](https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets.consentStores) +* [API documentation](https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.consentStores) * How-to Guides * [Creating a Consent store](https://cloud.google.com/healthcare/docs/how-tos/consent) @@ -43,15 +41,11 @@ To get more information about ConsentStore, see: ```hcl resource "google_healthcare_dataset" "dataset" { - provider = google-beta - location = "us-central1" name = "my-dataset" } resource "google_healthcare_consent_store" "my-consent" { - provider = google-beta - dataset = google_healthcare_dataset.dataset.id name = "my-consent-store" } @@ -67,15 +61,11 @@ resource "google_healthcare_consent_store" "my-consent" { ```hcl resource "google_healthcare_dataset" "dataset" { - provider = google-beta - location = "us-central1" name = "my-dataset" } resource "google_healthcare_consent_store" "my-consent" { - provider = google-beta - dataset = google_healthcare_dataset.dataset.id name = "my-consent-store" @@ -97,29 +87,21 @@ resource "google_healthcare_consent_store" "my-consent" { ```hcl resource "google_healthcare_dataset" "dataset" { - provider = google-beta - location = "us-central1" name = "my-dataset" } resource "google_healthcare_consent_store" "my-consent" { - provider = google-beta - dataset = google_healthcare_dataset.dataset.id name = "my-consent-store" } resource "google_service_account" "test-account" { - provider = google-beta - account_id = "my-account" display_name = "Test Service Account" } resource "google_healthcare_consent_store_iam_member" "test-iam" { - provider = google-beta - dataset = google_healthcare_dataset.dataset.id consent_store_id = google_healthcare_consent_store.my-consent.name role = "roles/editor" @@ -153,7 +135,7 @@ The following arguments are supported: * `enable_consent_create_on_update` - (Optional) - If true, [consents.patch] [google.cloud.healthcare.v1beta1.consent.UpdateConsent] creates the consent if it does not already exist. + If true, [consents.patch] [google.cloud.healthcare.v1.consent.UpdateConsent] creates the consent if it does not already exist. * `labels` - (Optional) @@ -190,6 +172,4 @@ ConsentStore can be imported using any of these accepted formats: ``` $ terraform import google_healthcare_consent_store.default {{dataset}}/consentStores/{{name}} -$ terraform import google_healthcare_consent_store.default {{dataset}}/{{name}} -$ terraform import google_healthcare_consent_store.default {{name}} ``` diff --git a/website/docs/r/healthcare_consent_store_iam.html.markdown b/website/docs/r/healthcare_consent_store_iam.html.markdown index 4d5e4d46a7..cb6659eb99 100644 --- a/website/docs/r/healthcare_consent_store_iam.html.markdown +++ b/website/docs/r/healthcare_consent_store_iam.html.markdown @@ -32,8 +32,6 @@ Three different resources help you manage your IAM policy for Cloud Healthcare C ~> **Note:** `google_healthcare_consent_store_iam_binding` resources **can be** used in conjunction with `google_healthcare_consent_store_iam_member` resources **only if** they do not grant privilege to the same role. -~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. ## google\_healthcare\_consent\_store\_iam\_policy