Skip to content

Commit

Permalink
feat: Onboard Diversity Annual Report and complementary datasets (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlersantos committed May 19, 2022
1 parent f593161 commit 4a8a2cd
Show file tree
Hide file tree
Showing 14 changed files with 1,198 additions and 338 deletions.
204 changes: 104 additions & 100 deletions datasets/google_dei/infra/diversity_annual_report_pipeline.tf

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions datasets/google_dei/infra/google_dei_dataset.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ resource "google_bigquery_dataset" "google_dei" {
description = "Diversity, Equity, and Inclusion (DEI) includes demographic data on workforce representation, hiring, and attrition of employees at Google"
}

data "google_iam_policy" "bq_ds__google_dei" {
dynamic "binding" {
for_each = var.iam_policies["bigquery_datasets"]["google_dei"]
content {
role = binding.value["role"]
members = binding.value["members"]
}
}
}

resource "google_bigquery_dataset_iam_policy" "google_dei" {
dataset_id = google_bigquery_dataset.google_dei.dataset_id
policy_data = data.google_iam_policy.bq_ds__google_dei.policy_data
}
output "bigquery_dataset-google_dei-dataset_id" {
value = google_bigquery_dataset.google_dei.dataset_id
}

resource "google_storage_bucket" "ggl-dei" {
name = "${var.bucket_name_prefix}-ggl-dei"
force_destroy = true
location = "US"
uniform_bucket_level_access = true
lifecycle {
ignore_changes = [
Expand Down
3 changes: 3 additions & 0 deletions datasets/google_dei/infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ variable "bucket_name_prefix" {}
variable "impersonating_acct" {}
variable "region" {}
variable "env" {}
variable "iam_policies" {
default = {}
}

1 change: 1 addition & 0 deletions datasets/google_dei/pipelines/dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ resources:
- type: storage_bucket
name: "ggl-dei"
uniform_bucket_level_access: True
location: US

Large diffs are not rendered by default.

386 changes: 268 additions & 118 deletions datasets/google_dei/pipelines/diversity_annual_report/pipeline.yaml

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions datasets/nces/infra/ipeds_pipeline.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


resource "google_bigquery_table" "nces_ipeds_c2020_a" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "c2020_a"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_c2020_a-table_id" {
value = google_bigquery_table.nces_ipeds_c2020_a.table_id
}

output "bigquery_table-nces_ipeds_c2020_a-id" {
value = google_bigquery_table.nces_ipeds_c2020_a.id
}

resource "google_bigquery_table" "nces_ipeds_c2020_a_dict_frequencies" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "c2020_a_dict_frequencies"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_c2020_a_dict_frequencies-table_id" {
value = google_bigquery_table.nces_ipeds_c2020_a_dict_frequencies.table_id
}

output "bigquery_table-nces_ipeds_c2020_a_dict_frequencies-id" {
value = google_bigquery_table.nces_ipeds_c2020_a_dict_frequencies.id
}

resource "google_bigquery_table" "nces_ipeds_hd2020" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "hd2020"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_hd2020-table_id" {
value = google_bigquery_table.nces_ipeds_hd2020.table_id
}

output "bigquery_table-nces_ipeds_hd2020-id" {
value = google_bigquery_table.nces_ipeds_hd2020.id
}

resource "google_bigquery_table" "nces_ipeds_hd2020_dict_frequencies" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "hd2020_dict_frequencies"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_hd2020_dict_frequencies-table_id" {
value = google_bigquery_table.nces_ipeds_hd2020_dict_frequencies.table_id
}

output "bigquery_table-nces_ipeds_hd2020_dict_frequencies-id" {
value = google_bigquery_table.nces_ipeds_hd2020_dict_frequencies.id
}

resource "google_bigquery_table" "nces_ipeds_ic2020" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "ic2020"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_ic2020-table_id" {
value = google_bigquery_table.nces_ipeds_ic2020.table_id
}

output "bigquery_table-nces_ipeds_ic2020-id" {
value = google_bigquery_table.nces_ipeds_ic2020.id
}

resource "google_bigquery_table" "nces_ipeds_ic2020_dict_frequencies" {
project = var.project_id
dataset_id = "nces_ipeds"
table_id = "ic2020_dict_frequencies"
depends_on = [
google_bigquery_dataset.nces_ipeds
]
}

output "bigquery_table-nces_ipeds_ic2020_dict_frequencies-table_id" {
value = google_bigquery_table.nces_ipeds_ic2020_dict_frequencies.table_id
}

output "bigquery_table-nces_ipeds_ic2020_dict_frequencies-id" {
value = google_bigquery_table.nces_ipeds_ic2020_dict_frequencies.id
}
56 changes: 56 additions & 0 deletions datasets/nces/infra/nces_dataset.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


resource "google_bigquery_dataset" "nces_ipeds" {
dataset_id = "nces_ipeds"
project = var.project_id
description = "The National Center for Education Statistics (NCES) collects, analyzes and makes available data related to education in the U.S. and other nations.\nThe Integrated Postsecondary Education Data System (IPEDS) contains information on U.S. colleges, universities, and technical and vocational institutions."
}

data "google_iam_policy" "bq_ds__nces_ipeds" {
dynamic "binding" {
for_each = var.iam_policies["bigquery_datasets"]["nces_ipeds"]
content {
role = binding.value["role"]
members = binding.value["members"]
}
}
}

resource "google_bigquery_dataset_iam_policy" "nces_ipeds" {
dataset_id = google_bigquery_dataset.nces_ipeds.dataset_id
policy_data = data.google_iam_policy.bq_ds__nces_ipeds.policy_data
}
output "bigquery_dataset-nces_ipeds-dataset_id" {
value = google_bigquery_dataset.nces_ipeds.dataset_id
}

resource "google_storage_bucket" "nces" {
name = "${var.bucket_name_prefix}-nces"
force_destroy = true
location = "US"
uniform_bucket_level_access = true
lifecycle {
ignore_changes = [
logging,
]
}
}

output "storage_bucket-nces-name" {
value = google_storage_bucket.nces.name
}
28 changes: 28 additions & 0 deletions datasets/nces/infra/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


provider "google" {
project = var.project_id
impersonate_service_account = var.impersonating_acct
region = var.region
}

data "google_client_openid_userinfo" "me" {}

output "impersonating-account" {
value = data.google_client_openid_userinfo.me.email
}
26 changes: 26 additions & 0 deletions datasets/nces/infra/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


variable "project_id" {}
variable "bucket_name_prefix" {}
variable "impersonating_acct" {}
variable "region" {}
variable "env" {}
variable "iam_policies" {
default = {}
}

32 changes: 32 additions & 0 deletions datasets/nces/pipelines/dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dataset:
name: nces
friendly_name: ~
description: ~
dataset_sources: ~
terms_of_use: ~

resources:
- type: bigquery_dataset
dataset_id: nces_ipeds
description: |-
The National Center for Education Statistics (NCES) collects, analyzes and makes available data related to education in the U.S. and other nations.
The Integrated Postsecondary Education Data System (IPEDS) contains information on U.S. colleges, universities, and technical and vocational institutions.
- type: storage_bucket
name: "nces"
uniform_bucket_level_access: True
location: US

0 comments on commit 4a8a2cd

Please sign in to comment.