. ├── README.md ├── alb-asg.tf ├── cli.py ├── ec2-instances.tf ├── nginx.sh ├── nginx.tpl ├── provider.tf ├── secgroup.tf ├── terraform-cli.pem ├── terraform.tfstate ├── terraform.tfstate.backup ├── variables.tf └── vpc.tf
-
STEP 1:
- Terraform v0.13.0
- provider registry.terraform.io/hashicorp/aws v3.2.0
- ADD AWS credentials in ~/.aws/config Example:
STEP 2:
[default] aws_access_key_id = Access key aws_secret_access_key = Secret_key
Create aws keypair to ssh access to ec2 instances
STEP 4:
ec2-instances: Replace with your aws-key private_key file path = "${file("{file_path}/terraform-cli.pem")}"
VPC - CIDR of 192.168.0.0/16 with Public Subnet for each AZs
SG - Ingress on 80 and ssh connection
ASG-ALB Min - 2, Max: 6 Health check on EC2 with sg for port 80
Output - LB DNS URL
Instead of "provisioner - ssh connection/ remote-exec" --> "user-data"
Cli - arg parser
This has to be user-data = "${file("terraform-cli.pem")}"