codequest-eu / terraform-modules

Terraform modules commonly used in our projects
5 stars 4 forks source link
terraform

Terraform modules

Terraform modules commonly used by our projects

Terraform version

Modules within this repository require terraform 0.12.x. If you're on 0.11.x use the terraform-0.11 branch, which is not actively developed anymore.

Modules

Local setup

To run examples you will need to prepare:

  1. Docker and docker-compose
  2. An AWS account with an Administrator IAM user
  3. Access key to authenticate as the Administrator
  4. (optional) Example working hosted zone to add DNS records to

    Some examples require a hosted zone to setup DNS records, e.g. to validate TLS certificates or route traffic to services.

Once these are ready:

  1. Copy .env.template to .env and fill in the blanks in .env

    1. AWS_PROFILE can be left empty if you want to use your default AWS CLI profile
    2. TF_VAR_zone_domain should contain the example hosted zone domain, e.g. terraform-examples.com
  2. Build the container with development tools

    docker-compose build
  3. Run the development shell

    docker-compose run --rm shell bash
  4. Go to one of the examples and terraform apply, e.g.

    cd iam/user/example
    terraform init
    terraform apply
  5. Destroy the example once you no longer need it

    cd iam/user/example
    terraform destroy