Terraform config that creates a basic GCP VM that host a nginx server. This project is meant to be used as a boilerplate only.
- Install terraform
Visit Google Console to create a service account.
Download the created key (json) gcloud-service.json
and place it in root folder.
Create terraform.tfvars
on root folder. For example.
gcp_project = "gcp-project-1234"
gcp_website_image = "nginx:latest"
Run these commands
terraform init
terraform plan
terraform apply
Update DNS config of the domain by added a new A
record with the ip
printed while running terraform apply
on step 3
.