A collection of simple Terraform examples to highlight the core concepts of Terraform using the AWS provider. All the examples deploy a simple EC2 Ubuntu instance.
You may need to configure access to AWS, by installing AWS CLI and running aws config
. The examples can be simply run doing:
terraform init
terraform apply
And cleaned up doing terraform destroy
In addition, a devcontainer has been set up so it can be started with VS Code and there is no need to install Terraform. By default it will copy the AWS CLI credentials from the user.
- HCL, resources and providers
- Using variables
- Generating output
- Avoid repetition with locals
- Query information using data sources
- Use modules to make things easier
- Verifying with checks, pre-conditions, post-conditions
- Encapsulate your code in modules
- Set up a remote backend
- Manage multiple environments
- Best practices
- Terragrunt