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 support for BigQuery table ACLs #3856

Merged
merged 2 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 24 additions & 1 deletion products/bigquery/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,30 @@ overrides: !ruby/object:Overrides::ResourceOverrides
constants: templates/terraform/constants/bigquery_job.go
encoder: templates/terraform/encoders/bigquery_job.go.erb
Table: !ruby/object:Overrides::Terraform::ResourceOverride
exclude: true
# legacy_name: 'google_bigquery_table'
edwardmedia marked this conversation as resolved.
Show resolved Hide resolved
base_url: 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}'
self_link: 'projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}'
exclude_resource: true
iam_policy: !ruby/object:Api::Resource::IamPolicy
method_name_separator: ':'
parent_resource_type: 'google_bigquery_table'
parent_resource_attribute: 'table_id'
fetch_iam_policy_verb: :POST
allowed_iam_role: 'roles/bigquery.dataOwner'
iam_conditions_request_type: :REQUEST_BODY
iam_policy_version: '1'
id_format: "{{table_id}}"
import_format: [
"projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}", "{{table_id}}"
]
examples:
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_bigquery_table"
primary_resource_id: "test"
primary_resource_name: "fmt.Sprintf(\"tf_test_dataset_id%s\", context[\"random_suffix\"]), fmt.Sprintf(\"tf_test_table_id%s\", context[\"random_suffix\"])"
vars:
dataset_id: "dataset_id"
table_id: "table_id"

# This is for copying files over
files: !ruby/object:Provider::Config::Files
Expand Down
53 changes: 53 additions & 0 deletions templates/terraform/examples/bigquery_bigquery_table.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
resource "google_bigquery_dataset" "test" {
dataset_id = "<%= ctx[:vars]['dataset_id'] %>"
}

resource "google_bigquery_table" "test" {
table_id = "<%= ctx[:vars]['table_id'] %>"
dataset_id = google_bigquery_dataset.test.dataset_id
time_partitioning {
type = "DAY"
}
schema = <<EOH
[
{
"name": "city",
"type": "RECORD",
"fields": [
{
"name": "id",
"type": "INTEGER"
},
{
"name": "coord",
"type": "RECORD",
"fields": [
{
"name": "lon",
"type": "FLOAT"
},
{
"name": "lat",
"type": "FLOAT"
}
]
}
]
},
{
"name": "country",
"type": "RECORD",
"fields": [
{
"name": "id",
"type": "INTEGER"
},
{
"name": "name",
"type": "STRING"
}
]
}
]
EOH
}