A demo project for introducing terraform.
This repo doesn't use a Terraform Backend which is generally a good practice. This repo is for DEMO purposes only.
For Datadog employees, you'll need to have
aws-vault
configured to provision
AWS resources.
This repo expects Terraform
Workspaces to be used.
See the example.tfvars file for workspace based variable
definitions that are expected. For the purposes of this document, the workspace
name and filename used for will be default
.
Use terraform workspace select default
to switch to this workspace. The
default.tfvars
should be used with this workspace when executing terraform
commands, e.g. terraform plan -var-file=default.tfvars
. This worksapce is
for the development team to create a one-for-one likeness with production at a
smaller scale to reduce cost.
For a quick rough script for the demo, please look at demo.md; below are instructions on how to work with this terraform configuration template.
- Switch into the worksapce you want to create, update, or destroy
infrastructure for, e.g.
terraform workspace select default
. A list of workspaces can be made available by typingterraform workspace list
. Rememberdefault
is the development workspace, see the Development ("Default") section for details. - Execute
terraform get
to download any modules that are being used in the configuration. - Execute
terraform plan -out=plan.out -var-file=<worksapce>.tfvars
- be sure to use the right<workspace>.tfvars
file; see the Workspaces section for more details. - When you are comfortable with the plan output, you can run
terraform apply plan.out
which will apply the plan from the previous step. The variable file does not need to be supplied again, it is built into the plan output. - To destroy infrastructure simply run
terraform destroy -var-file=default.tfvars
though there are times where you may want to plan a destroy first. To do so, add the-destroy
flag toterraform plan
and thenapply
the destroy plan.
MIT; see LICENSE for details.