Create 3 tier sample infra on AWS with Terraform
You infra structure will created as below.
You can change with your own infra structure configuration.
You infra security will created as below.
You can change with your own security configuruation.
You will need to install terraform on you local computer.
And setup AWS access key (You can use AWS CLI or just create your own).
Create secrets.tfvars
file
Add sensitive variable and values like below
# Your trusted external IP for SSH access
ssh-locate = "xx.xx.xx.xx/32" # Your SSH connection IP
# Your database user for production
db-user = "************" # your DB user
# Your database password for production
db-password = "************" # your DB password
Initialize terraform for run
terraform init
Format style for your terraform files
terraform fmt
Planing infra structure for change
Execute before apply
terraform plan -var-file="secrets.tfvars"
Check terraform file errors
terraform validate
Execute infra structure for production (Create / Change)
terraform apply -var-file="secrets.tfvars"
Remove infra structure for production
terraform destroy -var-file="secrets.tfvars"