In this repositroy there are 3 terrafrom modules, in order of dependency:
- private-vpc - Setup a VPC with private and public subnets
- bastion-host - Setup a bastion host to reach private resources
- ec2-instance - Deploy a simple ec2 instance
For more information on how to use this modules follow the examples in the examples directory. To use this repository, clone this repository and use the example directory as base dir.
- Terraform - Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.
- Amazon AWS Account - Amazon AWS account with billing enabled
- aws cli optional
Note that this tutorial uses AWS resources that are outside the AWS free tier, so be careful!
Follow the prerequisites step on this link. In your workspace folder or in the examples directory of this repo create a file named terraform.tfvars:
AWS_ACCESS_KEY = "xxxxxxxxxxxxxxxxx"
AWS_SECRET_KEY = "xxxxxxxxxxxxxxxxx"
Once you have cloned this repo, change directory to examples dir. Edit the example file (main.tf) and set the needed variables (change-me variables). Crate a terraform.tfvars file, for more detail see AWS provider setup and read all the modules requirements in each module directory.
Or if you prefer you can create a new empty directory in your workspace and start a new project from scratch. To setup the project follow the README.md in the examples directory.