TerraformΒΆ
Examples - https://github.com/hashicorp/terraform/tree/master/examples
Secrets management - https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1
Terragrunt - move remote state after moving folders:
# Dump out the state
terragrunt state pull > state.bkp.json
# Move the module to the new location
# In the new folder, import the state
terragrunt state push state.bkp.json
*.tf # configuration
terraform plan # show plan, check config
-out=<file> # save plan in file
-destroy # show what will be destroyed
-var '<key>=<val>' # add var
-var-file="v.tfvars" # add file with vars. File 'terraform.tfvars' load auto
VARS:
# file v.tfvars content
access_key = "foo"
secret_key = "bar"
terraform apply # run
terraform destroy # destroy resources
terraform show # inspect the state
terraform output # show only output (after apply)
terraform get # get the modules (before apply). Download the modules. By default, the command will not check for updates.
-u # check and download updates
terraform init github.com/hashicorp/terraform/examples/aws-two-tier
Create graph of dependencies:
sudo apt-get install graphviz
terraform graph | dot -Tpng > graph.png