## Terraform Commands
This basic compute demo will consist of the orchestration of blank t2.micro (free tier) EC2 instances into AWS.
- It is assumed that this demo is being ran from a UNIX based machine
- An AWS account -Sign up here-
- AWS SSH key-pair created and private key stored locally (this is used as the SSH key placed onto each new instance by Terraform, this key is then used for SSH access after creation is complete)
- This repository cloned locally (install Git here)
- Terraform installed (install it here)
####Networking:
- cd into
{location_of_this_repo}/aws/environments/{environment_you_wish_to_build}/networking
- open and edit
terraform.tfvars
according to your networking requirements - run command
export AWS_ACCESS_KEY_ID={your_access_key}
- run command
export AWS_SECRET_ACCESS_KEY={your_secret_key}
- run command
export AWS_DEFAULT_REGION={your_preferred_region}
- 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 infrastructure you have built, run command terraform destroy -state=./terraform.tfstate -var-file=./terraform.tfvars
####Compute:
- cd into
{location_of_this_repo}/aws/environments/{environment_you_wish_to_build}/compute
- open
terraform.tfvars
and enter a value for variablesvpc_id
andsubnet_id
from the networking infrastructure you have previously built,owner
andssh_key_name
(the name of the key associated with your AWS account), and save - run command
export AWS_ACCESS_KEY_ID={your_access_key}
- run command
export AWS_SECRET_ACCESS_KEY={your_secret_key}
- run command
export AWS_DEFAULT_REGION={your_preferred_region}
- 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 infrastructure you have built, run command terraform destroy -state=./terraform.tfstate -var-file=./terraform.tfvars