https://www.terraform.io/ offical docs
https://learn.hashicorp.com/terraform/getting-started/intro Get Started - AWS
Why not use ansible ? because changes to resources aren’t tracked.
Why didn’t we choose CloudFormation? Its support is limited to AWS.
Terraform config is code we write, state file is a json file. store these on the remote.
Plan is safe to do any where, apply we don’t comment any want. don’t apply locally, don’t apply locally, don’t apply locally!
|terraform init||Initiate Terraform. Terraform must be initiated before you plan/apply terraform.|
|terraform plan||You will be able to examine Terraform’s execution plan before you deploy it to AWS.|
|terraform apply||Deploy your final execution plan to AWS.|
|terraform init -upgrade||Update providers.|
|terraform state show||Inspect the current state.|
|terraform graph||Displays the visual dependency graph of Terraform resources according to configuration files in DIR (or the current directory if omitted).|
|terraform destroy||Destroy all resources created by terraform and also destroy the changes in your state file.|
||To save the displayed plan (from the ‘terraform plan’ command) for reference.|