hassanaftab93 / Terraform-AWS

This repo contains terraform code to deploy AWS Infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform Template

πŸ›  Strategy

  • SSH-Key -> first-key
    • ssh-keygen -t rsa
  • Assign first-key -> new instance
  • create security group on aws
  • assign group to instance

πŸ“‘ Steps

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

πŸ“š Contributing

Click here to learn more about: Contributions

βœ’οΈ Author

πŸ”— Links

Type Link
Portfolio portfolio
LinkedIn linkedin

About

This repo contains terraform code to deploy AWS Infrastructure

License:GNU General Public License v3.0


Languages

Language:HCL 80.2%Language:Makefile 19.0%Language:Shell 0.8%