Install Terrafrom and gcloud.
Step 1
A very simple Terraform example with GCP
Step 2
After making sure you have Terraform installed, create a simple file bigquery.tf then put these inside:
provider "google" {
project = "shiritech-488519"
region = "europe-north1"
}
resource "google_bigquery_dataset" "dataset" {
dataset_id = "test_dataset2"
friendly_name = "Example Test Dataset"
description = "Dataset created with Terraform"
}
*Remember that you can have several tf files in the same directory and Terraform will combine the together as a single file.Step 3
For Terraform to connect to GCP we need to login with gcloud first using:
gcloud auth application-default login
Select the correct user who has the permissions to the project. Step 4
Now we need to run the following commands:
terraform init #Connect to the backend
terraform validate #Make sure config is healthy
terraform plan #See the changes in advance
terraform apply #Apply the changes
Comments
Post a Comment