chrisb3ll / terraform

Example Terraform Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform

Example Infrastructure Provisioning

You will need

Environment Variables

  • export AWS_ACCESS_KEY_ID="yourAWSAccessKey"
  • export AWS_SECRET_ACCESS_KEY="yourAWSSecretKey"
  • export AWS_DEFAULT_REGION="yourAWSDefaultRegion"

Environment variable management is personal preference.
You could use direnv.

Key pairs

Terraform cannot create new key pairs, only import existing.
As a manual step either way, please create a key pair in the console.
Default expected is terraform_key.

Start

A simple bash wrapper tf.sh is available for use:

  usage: ./tf.sh [ -a value -e value -x 'value(s)' ]

     -a --> action: plan, push, apply
     -e --> environment: management, dev, test, prod etc.
     -x --> extra options: terraform args (optional)

Roles

Roles, in the context of this project, are a collection of Terraform configuration files.

shared:
Default
Re-usable configuration for creating similar environments (e.g. dev, tst, prd) Number of instances, IP address etc. defined in variable files

envName:
Specific configuration for non generic environment creation. (e.g. mgt)

Recommendations

  • Create a VPC per environment or role (dev, tst, mgt etc.)
  • Use a minimum two availability zones per VPC

About

Example Terraform Project

License:Apache License 2.0


Languages

Language:HCL 83.1%Language:Shell 16.9%