This project is an implementation of Terraform BigQuery Datasets
Layout
main.tf --> The main terraform files, this includes the module listed below
backend.tf --> Contains the backend configuration, which is a bucket in Google Storage
vars.tf --> Variable definition
terraform.tfvars --> Example how to set variables
modules/
dataset/
--> This module creates a set of datasets in BigQuery by using default
access permissions, or user defined access
Before you begin, you need to define credentials for the communication with GCP
export GOOGLE_APPLICATION_CREDENTIALS=/home/user/my_service_account.json
For more info, check: https://cloud.google.com/community/tutorials/managing-gcp-projects-with-terraform
Variable name | Type | Description | Default value |
project | String | The ID of the project the resource belongs | |
region | String | Region | |
datasets | List | A list of datasets to be created | |
dataset_access | List | A list of access maps e.g.
{
role = "OWNER"
user_by_email = "[email protected]"
},
{
role = "READER"
domain = "fofofo.com"
} |
$ terraform init
Terraform allows you to "Plan", which allows you to see what it would change without actually making any changes.
$ terraform plan
$ terraform apply
If you want to delete one or more datasets, then edit the terraform.tfvars
file and run again terraform apply
$ terraform apply
$ terraform destroy
Georgios Kasapoglou
Copyright 2019 Georgios Kasapoglou
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.