1.3.2 - Terraform Basics
Last updated Jan 25, 2025
Last updated
Last updated Jan 25, 2025
Last updated
Youtube Video | ~29 min
This video we set up a service account in our Google Cloud. We will then create a Main.tf file to configure our Google Cloud Infrastructure.
We create a keys/my-creds.json with private information. Be sure to not push this to github or anywhere public. Use a terraform gitignore to be safe https://github.com/github/gitignore/blob/main/Terraform.gitignore
Terraform provider for Google Cloud - The Google Cloud provider is used to configure your Google Cloud infrastructure.
To install this provider, copy and paste this code into your Terraform configuration. Then, run terraform init
.
Terraform 0.13+
Where my-project-id
comes from your GCP Dashboard.
+ Add a new bucket in Google cloud storage service (GCS) - in the same script append
Where auto-expire & name
need to be changed to a unique value, where name needs to be globally unique
You should now see this bucket created on your GCP
Terminal you can now run terraform init
Note in 1.3.3 we will create variables for these inputs
Terminal you can now run terraform plan
and then terraform apply
We can also generate the proposed changes and auto-executing the plan by using terraform apply -auto-approve
Terminal you can now run terraform destroy
once you are done