The repo holds the terraform configuration for the following functionalities
- Create VPC(Virtual Private Cloud) network
- Create Subnets inside VPC
- Create firewall rules like no-ssh and single port expose
- Create private service access to connect to cloud sql instance
- Add SQL instance private IP, database user, password etc to the VM instance env variables with the help of startup script concept
- Set up A record for DNS, which creates a link between DNS name and the VM instance
- Setup a service account and attach it to a VM with proper IAM roles like logging writes which helps to send logs to the google observability service
This repo is to manage google cloud platform automatically
- terraform init: The terraform init command initializes a new or existing Terraform configuration. It downloads the necessary providers and initializes the working directory.
Usage:
terraform init
- terraform plan: The terraform plan command creates an execution plan, outlining the actions Terraform will take to apply the desired state. It helps you understand the changes that will be made to your infrastructure.
Usage:
terraform plan
- terraform apply The terraform apply command applies the changes specified in the Terraform configuration. It prompts for confirmation before making any changes.
Usage:
terraform apply
Use -auto-approve to skip the confirmation prompt:
terraform apply -auto-approve
- terraform destroy The terraform destroy command is used to destroy the infrastructure created by the Terraform configuration. It prompts for confirmation before proceeding.
Usage:
terraform destroy
Use -auto-approve to skip the confirmation prompt:
terraform destroy -auto-approve
Note: Use terraform destroy cautiously, as it irreversibly deletes resources. Only execute this command when you want to tear down the infrastructure
Keywords:
- VPC
- Subnets
- Routes
- Firewalls
- VM
- Private Service Access
- Service Account
- Cloud SQL
- Cloud DNS
- IAM