1. terraform init:
  2. terraform plan:
  3. terraform apply:
  4. terraform destroy

Execution

# Refresh service-account's auth-token for this session
gcloud auth application-default login

# Initialize state file (.tfstate)
terraform init

# Check changes to new infra plan
# You can run as the terraform plan enter values as input
terraform plan -var="project=<your-gcp-project-id>"`

# Create new infra
terraform apply -var="project=<your-gcp-project-id>"`

`# Delete infra after your work, to avoid costs on any running services
terraform destroy

.terraform contains all the packages.

In this section we are reusing code from github. Available here: data-engineering-zoomcamp/week_1_basics_n_setup/1_terraform_gcp/terraform at main ยท DataTalksClub/data-engineering-zoomcamp (github.com)


Setting up the Environment on Google Cloud

Create a VM instance in Google Cloud.

Side Menu > Computer Engine > VM Instance. We need to generate an SSH key for the VM instance.

Untitled

You can google > create SSH keys for google cloud.

In the terminal write the following command -

cd ~/.ssh
ssh-keygen -t rsa -f ~/.ssh/gcp -C abd -b 2048