Skip to content

Commit

Permalink
Update dataplex_datascan_full_profile.tf.erb (hashicorp#8700) (hashic…
Browse files Browse the repository at this point in the history
…orp#15659)

* Update dataplex_datascan_full_profile.tf.erb

Add an export table

* Add env vars for export table

* Fix datascan and dataset references for full datascan example.

* Use a var for datascan name across all the examples.

* update resource name

* update resource name for IAM

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 29, 2023
1 parent 0d0ff2b commit 198cec3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .changelog/8700.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
20 changes: 10 additions & 10 deletions google/services/dataplex/iam_dataplex_datascan_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestAccDataplexDatascanIamBindingGenerated(t *testing.T) {
},
{
ResourceName: "google_dataplex_datascan_iam_binding.foo",
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-datascan%s", context["random_suffix"])),
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-dataprofile-basic%s", context["random_suffix"])),
ImportState: true,
ImportStateVerify: true,
},
Expand All @@ -55,7 +55,7 @@ func TestAccDataplexDatascanIamBindingGenerated(t *testing.T) {
},
{
ResourceName: "google_dataplex_datascan_iam_binding.foo",
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-datascan%s", context["random_suffix"])),
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-dataprofile-basic%s", context["random_suffix"])),
ImportState: true,
ImportStateVerify: true,
},
Expand All @@ -82,7 +82,7 @@ func TestAccDataplexDatascanIamMemberGenerated(t *testing.T) {
},
{
ResourceName: "google_dataplex_datascan_iam_member.foo",
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer user:[email protected]", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-datascan%s", context["random_suffix"])),
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s roles/viewer user:[email protected]", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-dataprofile-basic%s", context["random_suffix"])),
ImportState: true,
ImportStateVerify: true,
},
Expand All @@ -109,7 +109,7 @@ func TestAccDataplexDatascanIamPolicyGenerated(t *testing.T) {
},
{
ResourceName: "google_dataplex_datascan_iam_policy.foo",
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-datascan%s", context["random_suffix"])),
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-dataprofile-basic%s", context["random_suffix"])),
ImportState: true,
ImportStateVerify: true,
},
Expand All @@ -118,7 +118,7 @@ func TestAccDataplexDatascanIamPolicyGenerated(t *testing.T) {
},
{
ResourceName: "google_dataplex_datascan_iam_policy.foo",
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-datascan%s", context["random_suffix"])),
ImportStateId: fmt.Sprintf("projects/%s/locations/%s/dataScans/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), fmt.Sprintf("tf-test-dataprofile-basic%s", context["random_suffix"])),
ImportState: true,
ImportStateVerify: true,
},
Expand All @@ -130,7 +130,7 @@ func testAccDataplexDatascanIamMember_basicGenerated(context map[string]interfac
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -161,7 +161,7 @@ func testAccDataplexDatascanIamPolicy_basicGenerated(context map[string]interfac
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -207,7 +207,7 @@ func testAccDataplexDatascanIamPolicy_emptyBinding(context map[string]interface{
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -240,7 +240,7 @@ func testAccDataplexDatascanIamBinding_basicGenerated(context map[string]interfa
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -271,7 +271,7 @@ func testAccDataplexDatascanIamBinding_updateGenerated(context map[string]interf
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func testAccDataplexDatascan_dataplexDatascanBasicProfileExample(context map[str
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -111,7 +111,7 @@ func testAccDataplexDatascan_dataplexDatascanFullProfileExample(context map[stri
resource "google_dataplex_datascan" "full_profile" {
location = "us-central1"
display_name = "Full Datascan Profile"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataprofile-full%{random_suffix}"
description = "Example resource - Full Datascan Profile"
labels = {
author = "billing"
Expand All @@ -138,9 +138,26 @@ resource "google_dataplex_datascan" "full_profile" {
exclude_fields {
field_names = ["property_type"]
}
post_scan_actions {
bigquery_export {
results_table = "//bigquery.googleapis.com/projects/%{project_name}/datasets/tf_test_dataplex_dataset%{random_suffix}/tables/profile_export"
}
}
}
project = "%{project_name}"
depends_on = [
google_bigquery_dataset.source
]
}
resource "google_bigquery_dataset" "source" {
dataset_id = "tf_test_dataplex_dataset%{random_suffix}"
friendly_name = "test"
description = "This is a test description"
location = "US"
delete_contents_on_destroy = true
}
`, context)
}
Expand Down Expand Up @@ -175,7 +192,7 @@ func testAccDataplexDatascan_dataplexDatascanBasicQualityExample(context map[str
return acctest.Nprintf(`
resource "google_dataplex_datascan" "basic_quality" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataquality-basic%{random_suffix}"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -234,7 +251,7 @@ func testAccDataplexDatascan_dataplexDatascanFullQualityExample(context map[stri
resource "google_dataplex_datascan" "full_quality" {
location = "us-central1"
display_name = "Full Datascan Quality"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "tf-test-dataquality-full%{random_suffix}"
description = "Example resource - Full Datascan Quality"
labels = {
author = "billing"
Expand Down
25 changes: 21 additions & 4 deletions website/docs/r/dataplex_datascan.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To get more information about Datascan, see:
```hcl
resource "google_dataplex_datascan" "basic_profile" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "dataprofile-basic"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand All @@ -58,7 +58,7 @@ data_profile_spec {}
resource "google_dataplex_datascan" "full_profile" {
location = "us-central1"
display_name = "Full Datascan Profile"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "dataprofile-full"
description = "Example resource - Full Datascan Profile"
labels = {
author = "billing"
Expand All @@ -85,9 +85,26 @@ resource "google_dataplex_datascan" "full_profile" {
exclude_fields {
field_names = ["property_type"]
}
post_scan_actions {
bigquery_export {
results_table = "//bigquery.googleapis.com/projects/my-project-name/datasets/dataplex_dataset/tables/profile_export"
}
}
}
project = "my-project-name"
depends_on = [
google_bigquery_dataset.source
]
}
resource "google_bigquery_dataset" "source" {
dataset_id = "dataplex_dataset"
friendly_name = "test"
description = "This is a test description"
location = "US"
delete_contents_on_destroy = true
}
```
## Example Usage - Dataplex Datascan Basic Quality
Expand All @@ -96,7 +113,7 @@ resource "google_dataplex_datascan" "full_profile" {
```hcl
resource "google_dataplex_datascan" "basic_quality" {
location = "us-central1"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "dataquality-basic"
data {
resource = "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare"
Expand Down Expand Up @@ -129,7 +146,7 @@ resource "google_dataplex_datascan" "basic_quality" {
resource "google_dataplex_datascan" "full_quality" {
location = "us-central1"
display_name = "Full Datascan Quality"
data_scan_id = "tf-test-datascan%{random_suffix}"
data_scan_id = "dataquality-full"
description = "Example resource - Full Datascan Quality"
labels = {
author = "billing"
Expand Down

0 comments on commit 198cec3

Please sign in to comment.