Best video for learn terraform: Terraform Course - Automate your AWS cloud infrastructure https://www.youtube.com/watch?v=SLB_c_ayRMo
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.|
This is a good multi-version control tools for terraform. https://github.com/aaratn/terraenv
特别是在遇到权限不足的时候，如果想检查是具体哪个 service 权限不足。就需要 debug 输出详细的过程