apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
destroy Destroy Terraform-managed infrastructure
env Workspace management
fmt Rewrites config files to canonical format
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
refresh Update local state file against real resources
show Inspect Terraform state or plan
taint Manually mark a resource for recreation
untaint Manually unmark a resource as tainted
validate Validates the Terraform files
version Prints the Terraform version
workspace Workspace management
Thursday, May 28, 2020
Terraform Commands
Terraform Installation on mac OS
Download Terraform - https://www.terraform.io/downloads.html
Choose mac 64 bit OS and download the package
Once downloaded you can extract the package and copy it in /usr/lib file and it will work for you.
Another way of installing it on mac OS, as below
Go to your mac OS command prompt and type - Brew install terraform
Above command will install terraform on your mac OS
Terraform Installation on Windows Machine
Download Terraform - https://www.terraform.io/downloads.html
Choose Windows 32/64 bit OS and click on appropriate, It will download the installer
Go to the downloaded installer and right click on that - say Extract all
Go to Windows command prompt
Change Directory to extracted terraform folder
Set Path is mandatory - set PATH=%PATH%;d:\Terraform\terraform_0.12.26_windows_amd64\terraform.exe
You can also use environment variable to set this path
Check if Terraform is installed or not by using terraform -version command
Check If all Terraform commands are there, type terraform it will list all Terraform commands
Terraform Installation on Linux Machine
- Download Terraform - https://www.terraform.io/downloads.html
- Choose Linux OS 32/64 bit OS - Right click and say “copy link address”
- On your Linux machine - Create a folder called terraform
- Change Directory cd terraform on your Linux machine
- Run this command - wget https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip
- Note: If wget is not present please install it using yum install wget or apt-get install wget command, verify your wget version by using wget --version
- wget will download the terraform package from terraform website
- unzip the downloaded package by using unzip command
- If you don’t have unzip, zip command please install the same by using below commands
- Linux - sudo yum install -y zip unzip
- ubuntu - sudo apt-get install zip unzip
- unzip terraform_0.12.2_linux_amd64.zip.
- Set Path=/terraform:$PATH OR
- If you wish to use export it globally use below command - I personally Recommend this
- export PATH=/home/user-name/terraform/:$PATH
- Check if Terraform is installed or not by using terraform -version command
- Check If all Terraform commands are there, type terraform it will list all Terraform commands
What is Terraform?
- IaaC - Infrastructure as a Code
- Automation of Infrastructure
- Maintain the state of Infrastructure (state mgmt)
- Maintain Infrastructure change history using version control system like Git
- Terraform can automate any cloud and on premises infrastructure like VMware, AWS, Azure, GCP & Digital Ocean
- Unify the view of resources using IaaC
- Support modern data centre (Iaas, PaaS & SaaS)
- Expose a way satisfy the predictability change Infrastructure
- Manage anything with API
- Provides high level description of Infrastructure
- Support parallel mgmt of resources
- Separate planning from execution (dry-run) - By running a “plan”command
- Detailed documentation, lots of example, template provided by HashiCorp
- Provide a coding workflow to create infrastructure
- Expose workflow for managing updates to existing Infrastructure
- Integrate with application code workflow like Git & Code Review
- Provide modular, shareable component for separation of concern
- Human readable configuration is designed for human consumption, so user can quickly interpret and understand their infrastructure configuration
- HCL (HashiCorp Coding Language) includes full json parser for machine-generated configuration.
Tuesday, May 26, 2020
Why DevOps?
- The lower failure rate for new releases
- Increase deployment frequency
- Quicker mean time to recovery in the event of a new release crashing the application
- Shortened lead time between fixes
- Earlier to DevOps, the development and operation team worked in total isolation.
- Testing and Deployment were isolated phases and were done after design and build. Hence they required more time than actual build cycles.
- Without DevOps, team members are spending a large amount of their time in testing, deploying, and designing instead of focusing on the core part that is creating business services.
- Manual code deployment will lead to errors in production
- Development & Operation teams have a separate-timelines and are not in sync, causing additional delays
- Continuous Planning
- Collaborative Development
- Continuous Testing
- Continuous Release & Deployment
- Continuous Monitoring
- Continuous Feedback and Optimization