forked from GoogleCloudPlatform/magic-modules
-
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.
Add Dataplex Asset resource (GoogleCloudPlatform#6310)
* Initial commit, verify asset.yaml * Use an existing public bucket * Add Dataplex Asset into provider.go * Use a sample bucket instead of a hardcoded one * Fix asset YAML to have asset field * Fix asset YAML to have bucket field * Try again with a hardcoded bucket * minor syntax fix * Using handwritten tests since GCS buckets are not in DCL * Fix bucket name reference in Dataplex Asset * Ignore updates to bucket after creation * Change dataplex terraform resource name to primary for the tests * Add override for resource_spec.name. This is an immutable field and is normalized by the API. * upgrade dcl to 1.16 * Update test to use dataplexZone instead of zone * Add back comment accidentally removed in merge
- Loading branch information
1 parent
bdfd47f
commit 13bd241
Showing
9 changed files
with
86 additions
and
4 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
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
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
Empty file.
Empty file.
60 changes: 60 additions & 0 deletions
60
tpgtools/overrides/dataplex/samples/asset/basic_asset.tf.tmpl
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,60 @@ | ||
resource "google_storage_bucket" "basic_bucket" { | ||
name = "dataplex-bucket-%{random_suffix}" | ||
location = "{{region}}" | ||
uniform_bucket_level_access = true | ||
lifecycle { | ||
ignore_changes = [ | ||
labels | ||
] | ||
} | ||
|
||
project = "{{project}}" | ||
} | ||
|
||
resource "google_dataplex_lake" "basic_lake" { | ||
name = "{{lake}}" | ||
location = "{{region}}" | ||
project = "{{project}}" | ||
} | ||
|
||
|
||
resource "google_dataplex_zone" "basic_zone" { | ||
name = "{{zone}}" | ||
location = "{{region}}" | ||
lake = google_dataplex_lake.basic_lake.name | ||
type = "RAW" | ||
|
||
discovery_spec { | ||
enabled = false | ||
} | ||
|
||
|
||
resource_spec { | ||
location_type = "SINGLE_REGION" | ||
} | ||
|
||
project = "{{project}}" | ||
} | ||
|
||
|
||
resource "google_dataplex_asset" "primary" { | ||
name = "{{asset}}" | ||
location = "{{region}}" | ||
|
||
lake = google_dataplex_lake.basic_lake.name | ||
dataplex_zone = google_dataplex_zone.basic_zone.name | ||
|
||
discovery_spec { | ||
enabled = false | ||
} | ||
|
||
resource_spec { | ||
name = "projects/{{project}}/buckets/dataplex-bucket-%{random_suffix}" | ||
type = "STORAGE_BUCKET" | ||
} | ||
|
||
project = "{{project}}" | ||
depends_on = [ | ||
google_storage_bucket.basic_bucket | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
tpgtools/overrides/dataplex/samples/asset/basic_asset.yaml
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,16 @@ | ||
# optional test level config -- needed for updates basic.tf.tmpl def | ||
updates: | ||
- resource: ./basic_asset.tf.tmpl | ||
variables: | ||
- name: lake | ||
type: resource_name | ||
- name: zone | ||
type: resource_name | ||
- name: asset | ||
type: resource_name | ||
- name: bucket | ||
type: resource_name | ||
- name: project | ||
type: project | ||
- name: region | ||
type: region |
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,2 @@ | ||
ignore_read: | ||
- "resource_spec.0.name" |