Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bigquery connection of type CLOUD_RESOURCE & make other examples GA. #6020

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions mmv1/products/bigqueryconnection/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ name: BigqueryConnection
display_name: BigQuery Connection
versions:
- !ruby/object:Api::Product::Version
name: beta
base_url: https://bigqueryconnection.googleapis.com/v1beta1/
name: ga
base_url: https://bigqueryconnection.googleapis.com/v1/
scopes:
- https://www.googleapis.com/auth/bigquery
apis_required:
Expand Down Expand Up @@ -74,9 +74,11 @@ objects:
description: |
True if the connection has credential assigned.
- !ruby/object:Api::Type::NestedObject
name: cloudSql
name: 'cloudSql'
exactly_one_of:
- cloud_sql
- cloud_resource
description: Cloud SQL properties.
required: true
properties:
- !ruby/object:Api::Type::String
name: 'instanceId'
Expand Down Expand Up @@ -107,3 +109,15 @@ objects:
- :DATABASE_TYPE_UNSPECIFIED
- :POSTGRES
- :MYSQL
- !ruby/object:Api::Type::NestedObject
name: 'cloudResource'
exactly_one_of:
- cloud_sql
- cloud_resource
description: Cloud Resource properties.
send_empty_value: true
properties:
- !ruby/object:Api::Type::String
name: serviceAccountId
description: The account ID of the service created for the purpose of this connection.
output: true
8 changes: 6 additions & 2 deletions mmv1/products/bigqueryconnection/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
encoder: templates/terraform/encoders/bigquery_connection.go.erb
examples:
- !ruby/object:Provider::Terraform::Examples
min_version: beta
name: "bigquery_connection_basic"
pull_external: true
primary_resource_id: "connection"
Expand All @@ -47,7 +46,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
ignore_read_extra:
- "cloud_sql.0.credential" # password removed
- !ruby/object:Provider::Terraform::Examples
min_version: beta
name: "bigquery_connection_full"
pull_external: true
primary_resource_id: "connection"
Expand All @@ -64,6 +62,12 @@ overrides: !ruby/object:Overrides::ResourceOverrides
deletion_protection: "false"
ignore_read_extra:
- "cloud_sql.0.credential" # password removed
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_connection_cloud_resource"
pull_external: true
primary_resource_id: "connection"
vars:
connection_id: "my-connection"
# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_sql_database_instance" "instance" {
provider = google-beta
name = "<%= ctx[:vars]['database_instance_name'] %>"
database_version = "POSTGRES_11"
region = "us-central1"
Expand All @@ -11,7 +10,6 @@ resource "google_sql_database_instance" "instance" {
}

resource "google_sql_database" "db" {
provider = google-beta
instance = google_sql_database_instance.instance.name
name = "db"
}
Expand All @@ -22,14 +20,12 @@ resource "random_password" "pwd" {
}

resource "google_sql_user" "user" {
provider = google-beta
name = "<%= ctx[:vars]['username'] %>"
instance = google_sql_database_instance.instance.name
password = random_password.pwd.result
}

resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
friendly_name = "👋"
description = "a riveting description"
cloud_sql {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" {
connection_id = "<%= ctx[:vars]['connection_id'] %>"
location = "US"
friendly_name = "👋"
description = "a riveting description"
cloud_resource {}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resource "google_sql_database_instance" "instance" {
provider = google-beta
name = "<%= ctx[:vars]['database_instance_name'] %>"
database_version = "POSTGRES_11"
region = "us-central1"
Expand All @@ -11,7 +10,6 @@ resource "google_sql_database_instance" "instance" {
}

resource "google_sql_database" "db" {
provider = google-beta
instance = google_sql_database_instance.instance.name
name = "db"
}
Expand All @@ -22,14 +20,12 @@ resource "random_password" "pwd" {
}

resource "google_sql_user" "user" {
provider = google-beta
name = "<%= ctx[:vars]['username'] %>"
instance = google_sql_database_instance.instance.name
password = random_password.pwd.result
}

resource "google_bigquery_connection" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
connection_id = "<%= ctx[:vars]['connection_id'] %>"
location = "US"
friendly_name = "👋"
Expand Down