- SSH-Key -> first-key
-
- ssh-keygen -t rsa
- Assign first-key -> new instance
- create security group on aws
- assign group to instance
Important Commands
terraform init
terraform plan -var-file=var.tfvars
terraform apply -var-file=var.tfvars
terraform destroy
terraform destroy -target=resourcename
Terraform init: if changing backend block, run this first!
terraform init -migrate-state
Terraform prevent locking - Lock Mechanism using DynamoDB for AWS (noSQL)
DynamoDB -> Add Table -> TableName (name) -> Partition Key (LockID) -> Create
Extra Commands
terraform graph | dot -Tpdf > graph.pdf
terraform graph | dot -Tpdf > ../'terraform graph'/graph.pdf
Terraform Workspaces: To segregate tfstate files
terraform workspace help
terraform workspace new dev
terraform workspace new test
terraform workspace new prod
terraform workspace select dev
terraform workspace show
terraform workspace list
terraform workspace delete test
Click here to learn more about: Contributions