## Terraform Commands
This basic compute demo will consist of the orchestration of blank n1-standard-1 Google Compute instances and the basic networking that is required for this into Microsoft Azure.
- It is assumed that this demo is being ran from a UNIX based machine
- A Google Cloud Platform account -Sign up here-
- GCP API authentication credentials for your account stored locally, steps:
- Log into the Google Developers Console and select a project
- The API Manager view should be selected, click on "Credentials" on the left, then "Create credentials", and finally "Service account key"
- Select "Compute Engine default service account" in the "Service account" dropdown, and select "JSON" as the key type
- Clicking "Create" will download your credentials
- GCP API authentication credentials for your account stored locally, steps:
- This repository cloned locally (install Git here)
- Terraform installed (install it here)
- cd into
{location_of_this_repo}/azure/environments/{environment_you_wish_to_build}/networking
- open 'terraform.tfvars' and enter a value for variable
network_name
and save - run command
export GOOGLE_CREDENTIALS=$(cat {path_to_credentials_json_file_downloaded_in_prereqs})
- run command
export GOOGLE_PROJECT={your_gcp_project_name_here}
- run command
export GOOGLE_REGION={selected_gcp_region_here}
- run command
terraform get
- run command
terraform plan -var-file=./terraform.tfvars
- run command
terraform apply -state=./terraform.tfstate -var-file=./terraform.tfvars
- run command
cd ../compute
- open 'terraform.tfvars' and enter a value for variables
network_name
(the name of the network create above),owner
(used to identify the creator) and save - run command
terraform get
- run command
terraform plan -var-file=./terraform.tfvars
- run command
terraform apply -state=./terraform.tfstate -var-file=./terraform.tfvars
To destroy the compute infrastructure you have built, run command terraform destroy -state=./terraform.tfstate -var-file=./terraform.tfvars
To destroy the networking infrastructure you have built (from the compute directory), run command terraform destroy -state=../networking/terraform.tfstate -var-file=../networking/terraform.tfvars