- Install Terraform
Mac
brew install terraform
Linux
sudo apt-get install unzip
wget https://releases.hashicorp.com/terraform/0.11.1/terraform_0.11.1_linux_amd64.zip
unzip terraform_0.11.1_linux_amd64.zip
sudo mv terraform /usr/local/bin/
terraform --version
-
Modify (sandbox/dev/qa/prod)/terraform.auto.tfvars for your project and vpc name
-
cd init/(sandbox/dev/qa/prod)
a. follow setup-terraform-service-account.txt to create terraform service account (optional)
b. create bucket for terraform state files
terraform init
terraform plan
terraform apply
- Create VPC and Subnet
cd (sandbox/dev/qa/prod)/(us-east1/us-central-1)/network
terraform init
terraform plan -var-file="../../terraform.auto.tfvars"
terraform apply -var-file="../../terraform.auto.tfvars"
- Create firewalls
cd (sandbox/dev/qa/prod)/(us-east1/us-central-1)/firewall
terraform init
terraform plan -var-file="../../terraform.auto.tfvars"
terraform apply -var-file="../../terraform.auto.tfvars"
- Create NAT + Bastion
cd (sandbox/dev/qa/prod)/(us-east1/us-central-1)/nat-bastion
Update bastion_user and bastion-ssh-key
terraform init
terraform plan -var-file="../../terraform.auto.tfvars"
terraform apply -var-file="../../terraform.auto.tfvars"