Skip to content

Teraform IAC

Actually Use

terraform init
terraform show
terraform plan
terraform plan -var-file ./dentropycloud.tfvars
terraform apply
terraform apply -var-file ./dentropycloud.tfvars
terraform apply -destroy
terraform apply -destroy -var-file ./dentropycloud.tfvars

Install

Awesome Resources

Sources to review

Terraform Deep Dive

  • Terraform in 100 Seconds - YouTube
  • Cool I can deploy a VPS in google cloud
  • Where do I get the credentials
  • How do I access the VPS after
  • How do I install stuff on the VPS with cloudinit or Teraform
  • How do I do backups and restore
  • What about databases
  • What about object storage
  • Terraform explained in 15 mins | Terraform Tutorial for Beginners - YouTube
  • How is terraform different than wiki.software.List.Ansible?
    • Terraform is about provisioning infrastructure while ansible is about configuration
    • Ansible is more mature than terraform
  • Terraform is all about version control management of your infrastructure, great for managing different environments such as development, testing, and production
  • Terraform takes two things into core
    • Terraform config, and terraform state
  • Providers are API plugins for Kubernetes, AWS, Azure Google Cloud etc....
  • Declarative vs Imperative
    • YOU DEFINE THE END STATE YOU DESIRE (Declarative)
    • Saying what to do would be an imperative approach
  • Terraform commands
    • refresh - get current state
    • plan - display changes required to get to desired state
    • apply - actually do the changes to get to the desired state
    • destroy - KILL EVERYTHING (Will also check what is running and make a plan)
  • 8 Terraform Best Practices that will improve your TF workflow immediately - YouTube
  • NEVER EDIT THIS FILE terraform.tfstate
    • JSON file
    • This file is created by terraform apply
  • The terraform.tfstate file should be managed using remote storage for teams
  • To avoid two people editing the state file use state locking
    • Not all S3 storage backends support this
  • When you lost terraform.tfstate, remember to use version control, S3 has this built in
  • Use one state file per environment
  • GitOps, host terraform code in git
  • Who is allowed to make changes to the terraform code, MERGE REQUESTS
  • Use continuos integration
  • https://blog.gruntwork.io/a-comprehensive-guide-to-terraform-b3d32832baca
  • You can buy IOC for $800 a MONTH AWS Infrastructure as Code Library
  • Check hypothes

Things you can do with Terraform

  • Domain redirect HTTP 302
  • Create a VM, install docker, and connect block storage
  • Lambda CRON job
  • SETUP A MAILGUN PROVIDER
  • Setup a REVERSE PROXY
  • Deploy a static site on S3 From SCRATCH
  • Setup a site with HTTP BASIC AUTH
  • Deploy an entire wordpress site

Terraform Tutorials

Terraform example projects

Other Sources Judged