├── ECR ├── outputs.tf ├── providers.tf ├── ecr.tf └── .terraform.lock.hcl ├── .gitignore ├── BackEnd_FrontEnd_Project ├── 4_be-fe_Project_Refractor2 │ ├── production.tfvars │ ├── eip.tf │ ├── providers.tf │ ├── var.tf │ ├── sg.tf │ ├── ec2.tf │ └── .terraform.lock.hcl ├── 4_be-fe_Project │ ├── eip.tf │ ├── providers.tf │ ├── sg.tf │ ├── ec2.tf │ └── .terraform.lock.hcl ├── 4_be-fe_Project_Refractor1 │ ├── eip.tf │ ├── providers.tf │ ├── var.tf │ ├── sg.tf │ ├── ec2.tf │ └── .terraform.lock.hcl └── Backend FrontEnd Architecture.jpg ├── EKS ├── kub1.png ├── kub2.png ├── kub3.png ├── terraform │ ├── arch.png │ ├── provider.tf │ ├── internet-gateway.tf │ ├── eips.tf │ ├── vpc.tf │ ├── nat-gateways.tf │ ├── route-table-association.tf │ ├── routing-tables.tf │ ├── eks.tf │ ├── subnets.tf │ └── eks-node-groups.tf ├── k8s-consoledemo │ ├── nginx-svc.yaml │ └── nginx.yaml ├── steps.txt └── k8s-terraform │ └── app.yaml ├── README.md ├── DeepDive-TerraformFeatures ├── 6_provisioners │ ├── index.html │ ├── private_ip.txt │ ├── providers.tf │ ├── ec2.tf │ └── .terraform.lock.hcl ├── 8_Workspace │ ├── dev.plan │ ├── prod.plan │ ├── providers.tf │ ├── ec2.tf │ ├── var.tf │ └── .terraform.lock.hcl ├── 7_Modules │ ├── dev │ │ ├── ec2_webapp.tf │ │ └── .terraform.lock.hcl │ ├── prod │ │ ├── ec2_webapp.tf │ │ └── .terraform.lock.hcl │ └── modules │ │ ├── providers.tf │ │ ├── ec2.tf │ │ └── var.tf ├── 5_Import │ ├── providers.tf │ ├── ec2.tf │ └── .terraform.lock.hcl ├── 10_List_Count │ ├── providers.tf │ ├── var.tf │ └── ec2.tf ├── 7_Modules_Part2 │ ├── dev │ │ ├── providers.tf │ │ ├── ec2_webapp.tf │ │ └── .terraform.lock.hcl │ ├── prod │ │ ├── providers.tf │ │ ├── ec2_webapp.tf │ │ └── .terraform.lock.hcl │ └── modules │ │ ├── ec2 │ │ ├── var.tf │ │ └── ec2.tf │ │ └── nw │ │ ├── var.tf │ │ └── vpc.tf └── 9_Alias │ ├── eip.tf │ └── providers.tf ├── VPC_EC2_Project ├── VPC EC2 Project Architecture.jpg ├── 11_VPC_Project │ ├── providers.tf │ ├── subnet.tf │ ├── ec2.tf │ ├── routetable.tf │ ├── vpc.tf │ └── .terraform.lock.hcl └── 11_VPC_Project_Refractor │ ├── providers.tf │ ├── production.tfvars │ ├── output.tf │ ├── var.tf │ ├── subnet.tf │ ├── ec2.tf │ ├── routetable.tf │ ├── vpc.tf │ └── .terraform.lock.hcl ├── amazon-ecs-nodejs-microservices ├── 2-containerized │ └── services │ │ └── api │ │ ├── Dockerfile │ │ ├── package.json │ │ ├── server.js │ │ └── db.json └── steps.txt ├── AmazonElasticComputeCloud_EC2 └── ec2_lab │ ├── providers.tf │ ├── userdata.sh │ ├── ec2.tf │ └── .terraform.lock.hcl ├── ECS ├── providers.tf ├── outputs.tf ├── logs.tf ├── alb.tf ├── variables.tf ├── roles.tf ├── security.tf ├── .terraform.lock.hcl ├── ecs.tf ├── network.tf └── auto_scaling.tf ├── S3_EIP ├── ElasticIP_EIP │ └── eip-lab │ │ ├── providers.tf │ │ ├── eip.tf │ │ ├── ec2.tf │ │ └── .terraform.lock.hcl └── AmazonSimpleStorageService_S3 │ └── s3-lab │ ├── providers.tf │ ├── s3.tf │ └── .terraform.lock.hcl ├── BestPractices └── 14_remote-backend_lab │ ├── providers.tf │ ├── eip.tf │ ├── backend.tf │ └── .terraform.lock.hcl ├── Lambda_APIGateway_CloudWatch_Serverless ├── 13_lambda_lab_1 │ ├── lambda.zip │ ├── lambda.py │ ├── providers.tf │ ├── .terraform.lock.hcl │ └── lambda.tf ├── lambda apigateway Architecture.jpeg └── 13_lambda_apigateway_lab_2 │ ├── lambda.py │ ├── lambda.zip │ ├── providers.tf │ ├── .terraform.lock.hcl │ ├── lambda.tf │ └── apigateway.tf └── LoadBalance_AutoScaling_Project ├── 12_LB_Project_ALB_Part2 ├── providers.tf ├── production.tfvars ├── output.tf ├── var.tf ├── vpc.tf ├── subnet.tf ├── routetable.tf ├── .terraform.lock.hcl ├── ec2.tf ├── alb.tf └── sg.tf ├── 12_LB_Project_ASG_Part3 ├── providers.tf ├── production.tfvars ├── output.tf ├── var.tf ├── vpc.tf ├── subnet.tf ├── routetable.tf ├── .terraform.lock.hcl ├── asg.tf ├── ec2.tf ├── alb.tf └── sg.tf ├── 12_LB_Project ├── providers.tf ├── production.tfvars ├── output.tf ├── var.tf ├── vpc.tf ├── subnet.tf ├── routetable.tf ├── .terraform.lock.hcl ├── sg.tf └── ec2.tf └── LoadBalancer AutoScaling Project Architecture.jpeg /ECR/outputs.tf: -------------------------------------------------------------------------------- 1 | output "ecr_image_url" { 2 | value = aws_ecr_repository.ecr_lab 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.tfstate* 2 | .terraform.tfstate* 3 | *.xml 4 | .node* 5 | .terraform/ 6 | 7 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/production.tfvars: -------------------------------------------------------------------------------- 1 | instance_type="t2.micro" 2 | -------------------------------------------------------------------------------- /EKS/kub1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/EKS/kub1.png -------------------------------------------------------------------------------- /EKS/kub2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/EKS/kub2.png -------------------------------------------------------------------------------- /EKS/kub3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/EKS/kub3.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # master_aws_with_terraform 2 | Contains source code for my course - Master Terraform with AWS 3 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/6_provisioners/index.html: -------------------------------------------------------------------------------- 1 | "hi i am ec2 instance webserver triggered by remote-exec" -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/6_provisioners/private_ip.txt: -------------------------------------------------------------------------------- 1 | 172.31.87.123 2 | 172.31.82.133 3 | 172.31.24.130 4 | -------------------------------------------------------------------------------- /EKS/terraform/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/EKS/terraform/arch.png -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "fe_eip" { 2 | instance = "${aws_instance.front_end_ec2.id}" 3 | } 4 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "fe_eip" { 2 | instance = "${aws_instance.my_ec2s[0].id}" 3 | } 4 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "fe_eip" { 2 | instance = "${aws_instance.front_end_ec2.id}" 3 | } 4 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/dev.plan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/DeepDive-TerraformFeatures/8_Workspace/dev.plan -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/dev/ec2_webapp.tf: -------------------------------------------------------------------------------- 1 | module "my_ec2" { 2 | source = "../modules" 3 | instance_type = "t2.nano" 4 | ec2_name = "my_dev_EC2" 5 | } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/prod.plan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/DeepDive-TerraformFeatures/8_Workspace/prod.plan -------------------------------------------------------------------------------- /VPC_EC2_Project/VPC EC2 Project Architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/VPC_EC2_Project/VPC EC2 Project Architecture.jpg -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/prod/ec2_webapp.tf: -------------------------------------------------------------------------------- 1 | module "my_ec2" { 2 | source = "../modules" 3 | instance_type = "t2.large" 4 | ec2_name = "my_prod_EC2" 5 | } -------------------------------------------------------------------------------- /EKS/terraform/provider.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /amazon-ecs-nodejs-microservices/2-containerized/services/api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18 2 | WORKDIR /srv 3 | ADD . . 4 | RUN npm install 5 | 6 | EXPOSE 3000 7 | CMD ["node", "server.js"] 8 | -------------------------------------------------------------------------------- /AmazonElasticComputeCloud_EC2/ec2_lab/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-central-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | } -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/Backend FrontEnd Architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/BackEnd_FrontEnd_Project/Backend FrontEnd Architecture.jpg -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/5_Import/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } -------------------------------------------------------------------------------- /ECR/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | 3 | region = "us-east-1" 4 | #profile = "default" 5 | access_key = "pasteyouraccesskeyhere" 6 | secret_key = "pasteyoursecretkeyhere" 7 | 8 | } 9 | -------------------------------------------------------------------------------- /ECS/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | 3 | region = "us-east-1" 4 | 5 | #profile = "default" 6 | access_key = "pasteyouraccesskeyhere" 7 | secret_key = "pasteyoursecretkeyhere" 8 | } 9 | -------------------------------------------------------------------------------- /S3_EIP/ElasticIP_EIP/eip-lab/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } 8 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-central-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /BestPractices/14_remote-backend_lab/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/6_provisioners/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/modules/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_lab_1/lambda.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/Lambda_APIGateway_CloudWatch_Serverless/13_lambda_lab_1/lambda.zip -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/10_List_Count/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | access_key = "Paste your access key here" 4 | secret_key = "Paste your secret key here" 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/dev/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/prod/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } -------------------------------------------------------------------------------- /S3_EIP/AmazonSimpleStorageService_S3/s3-lab/providers.tf: -------------------------------------------------------------------------------- 1 | 2 | provider "aws" { 3 | region = "eu-central-1" 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | 7 | } 8 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "${var.region}" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-central-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_lab_1/lambda.py: -------------------------------------------------------------------------------- 1 | def lambda_handler(event , context): 2 | print("hello world from Terraform - lambda lab") 3 | return "hello world from Terraform - lambda lab" -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/production.tfvars: -------------------------------------------------------------------------------- 1 | region="us-east-1" 2 | availability_zone="us-east-1a" 3 | vpc_cidr="10.0.0.0/16" 4 | public_subnet_cidr="10.0.0.0/24" 5 | private_subnet_cidr="10.0.16.0/20" -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-central-1" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/lambda apigateway Architecture.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/Lambda_APIGateway_CloudWatch_Serverless/lambda apigateway Architecture.jpeg -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "${var.region}" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "${var.region}" 3 | access_key = "pasteyouraccesskeyhere" 4 | secret_key = "pasteyoursecretkeyhere" 5 | 6 | } 7 | -------------------------------------------------------------------------------- /ECS/outputs.tf: -------------------------------------------------------------------------------- 1 | # outputs.tf 2 | 3 | # output "ecr_image_url" { 4 | # value = aws_ecr_repository.ecr_lab.repository_url 5 | # } 6 | 7 | output "alb_hostname" { 8 | value = aws_alb.main.dns_name 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/lambda.py: -------------------------------------------------------------------------------- 1 | def lambda_handler(event , context): 2 | print("hello world from Terraform - lambda lab") 3 | return "hello world from Terraform - lambda lab" -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/lambda.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/lambda.zip -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_lab_1/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /BestPractices/14_remote-backend_lab/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "myEIP" { 2 | domain = "vpc" 3 | } 4 | 5 | output "ec2_public_ip" { 6 | value = "${aws_eip.myEIP.public_ip}" 7 | } 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/9_Alias/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "myeip_in_us-east-1" { 2 | vpc = true 3 | } 4 | 5 | resource "aws_eip" "myeip_in_eu-central-1" { 6 | provider = "aws.frankfurt" 7 | vpc = true 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "${var.region}" 3 | 4 | access_key = "pasteyouraccesskeyhere" 5 | secret_key = "pasteyoursecretkeyhere" 6 | } 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/LoadBalancer AutoScaling Project Architecture.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robinpaul84/master_terraform_with_aws/HEAD/LoadBalance_AutoScaling_Project/LoadBalancer AutoScaling Project Architecture.jpeg -------------------------------------------------------------------------------- /AmazonElasticComputeCloud_EC2/ec2_lab/userdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | yum update -y 3 | yum install -y httpd 4 | systemctl start httpd.service 5 | systemctl enable httpd.service 6 | echo "Hi Friend , I am $(hostname -f)" > /var/www/html/index.html -------------------------------------------------------------------------------- /amazon-ecs-nodejs-microservices/2-containerized/services/api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "koa": "^1.2.5", 4 | "koa-router": "^5.4.0" 5 | }, 6 | "scripts": { 7 | "start": "node server.js" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /S3_EIP/AmazonSimpleStorageService_S3/s3-lab/s3.tf: -------------------------------------------------------------------------------- 1 | resource "aws_s3_bucket" "my_s3_bucket" { 2 | bucket = "terraform-s3-bucket-xxxxx" 3 | //acl = "public-read" 4 | 5 | tags = { 6 | Name = "My bucket" 7 | Environment = "Dev" 8 | } 9 | } -------------------------------------------------------------------------------- /S3_EIP/ElasticIP_EIP/eip-lab/eip.tf: -------------------------------------------------------------------------------- 1 | resource "aws_eip" "my_first_eip" { 2 | instance = "${aws_instance.MyFirstEc2instance_from_terraform-EIP_demo.id}" 3 | domain = "vpc" 4 | } 5 | 6 | output "my_eip_address" { 7 | value = "${aws_eip.my_first_eip.public_ip}" 8 | } 9 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-09cb21a1e29bcebf0" 3 | } 4 | 5 | variable "instance_type" { 6 | default = "t2.micro" 7 | } 8 | 9 | variable "subnetid" { 10 | default = "subnet-02561f643a450c0ce" 11 | } 12 | 13 | -------------------------------------------------------------------------------- /EKS/k8s-consoledemo/nginx-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: nginx 5 | labels: 6 | run: nginx 7 | spec: 8 | ports: 9 | - port: 80 10 | protocol: TCP 11 | selector: 12 | run: nginx 13 | type: LoadBalancer -------------------------------------------------------------------------------- /ECR/ecr.tf: -------------------------------------------------------------------------------- 1 | resource "aws_ecr_repository" "ecr_lab" { 2 | name = "ecr-repo-for-tf-lab" 3 | image_tag_mutability = "MUTABLE" 4 | 5 | image_scanning_configuration { 6 | scan_on_push = true 7 | } 8 | tags = { 9 | Name = "ecs_demo_terraform_course" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "myec2" { 2 | ami = "${var.ami}" 3 | instance_type = "${lookup(var.instance_type, terraform.workspace)}" 4 | tags = { 5 | Name = "${lookup(var.ec2_name, terraform.workspace)}" 6 | } 7 | availability_zone = "${var.availability_zone}" 8 | } 9 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/modules/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "myec2_forwebapp" { 2 | ami = "${var.ami}" 3 | instance_type = "${var.instance_type}" 4 | security_groups = ["default"] 5 | tags = { 6 | Name = "${var.ec2_name}" 7 | } 8 | availability_zone = "${var.availability_zone}" 9 | } 10 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/modules/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-09cb21a1e29bcebf0" 3 | } 4 | 5 | variable "instance_type" { 6 | default = "t2.nano" 7 | } 8 | 9 | variable "ec2_name" { 10 | default = "" 11 | } 12 | 13 | variable "availability_zone" { 14 | default = "eu-central-1a" 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-09cb21a1e29bcebf0" 3 | } 4 | 5 | variable "instance_type" { 6 | default = "t2.micro" 7 | } 8 | 9 | variable "subnetid" { 10 | default = "subnet-02561f643a450c0ce" 11 | } 12 | 13 | variable "ec2s" { 14 | type = list 15 | default = ["ec2_fe","ec2_be"] 16 | } 17 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/10_List_Count/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-0b898040803850657" 3 | } 4 | 5 | variable "instance_type" { 6 | default = "t2.micro" 7 | } 8 | 9 | variable "availability_zone" { 10 | type = list 11 | default = ["us-east-1a", 12 | "us-east-1b", 13 | "us-east-1c" 14 | ] 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/9_Alias/providers.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | access_key = "Paste your access key here" 4 | secret_key = "Paste your secret key here" 5 | 6 | } 7 | 8 | provider "aws" { 9 | alias = "frankfurt" 10 | region = "eu-central-1" 11 | access_key = "Paste your access key here" 12 | secret_key = "Paste your secret key here" 13 | 14 | } 15 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/production.tfvars: -------------------------------------------------------------------------------- 1 | region="us-east-1" 2 | vpc_cidr="10.0.0.0/16" 3 | availability_zone=["us-east-1a","us-east-1b"] 4 | public_subnet_names=["public_subnet_1a","public_subnet_1b"] 5 | private_subnet_names=["private_subnet_1a","private_subnet_1b"] 6 | public_subnet_cidr=["10.0.0.0/24","10.0.1.0/24"] 7 | private_subnet_cidr=["10.0.2.0/24","10.0.3.0/24"] 8 | 9 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/production.tfvars: -------------------------------------------------------------------------------- 1 | region="us-east-1" 2 | vpc_cidr="10.0.0.0/16" 3 | availability_zone=["us-east-1a","us-east-1b"] 4 | public_subnet_names=["public_subnet_1a","public_subnet_1b"] 5 | private_subnet_names=["private_subnet_1a","private_subnet_1b"] 6 | public_subnet_cidr=["10.0.0.0/24","10.0.1.0/24"] 7 | private_subnet_cidr=["10.0.2.0/24","10.0.3.0/24"] 8 | 9 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/production.tfvars: -------------------------------------------------------------------------------- 1 | region="us-east-1" 2 | vpc_cidr="10.0.0.0/16" 3 | availability_zone=["us-east-1a","us-east-1b"] 4 | public_subnet_names=["public_subnet_1a","public_subnet_1b"] 5 | private_subnet_names=["private_subnet_1a","private_subnet_1b"] 6 | public_subnet_cidr=["10.0.0.0/24","10.0.1.0/24"] 7 | private_subnet_cidr=["10.0.2.0/24","10.0.3.0/24"] 8 | 9 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/modules/ec2/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-09cb21a1e29bcebf0" 3 | } 4 | 5 | variable "instance_type" { 6 | default = "t2.nano" 7 | } 8 | 9 | variable "ec2_name" { 10 | default = "" 11 | } 12 | 13 | variable "availability_zone" { 14 | default = "eu-central-1a" 15 | } 16 | variable "subnet_id" { 17 | default = "" 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/output.tf: -------------------------------------------------------------------------------- 1 | output "vpc" { 2 | value = "${aws_vpc.mainvpc}" 3 | } 4 | output "vpc_id" { 5 | value = "${aws_vpc.mainvpc.id}" 6 | } 7 | 8 | output "vpc_cidr" { 9 | value = "${aws_vpc.mainvpc.cidr_block}" 10 | } 11 | 12 | 13 | output "public_subnet_id" { 14 | value = "${aws_subnet.PublicSubnet_A.id}" 15 | } 16 | 17 | output "private_subnet_id" { 18 | value = "${aws_subnet.PrivateSubnet_A.id}" 19 | } -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/var.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | 3 | } 4 | 5 | variable "vpc_cidr" { 6 | 7 | } 8 | 9 | variable "instance_type" { 10 | default = "t2.micro" 11 | } 12 | 13 | variable "ami" { 14 | default = "ami-04cb4ca688797756f" 15 | 16 | } 17 | 18 | variable "public_subnet_cidr" { 19 | 20 | } 21 | 22 | variable "private_subnet_cidr" { 23 | 24 | } 25 | 26 | variable "availability_zone" { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/dev/ec2_webapp.tf: -------------------------------------------------------------------------------- 1 | module "my_vpc" { 2 | source = "../modules/nw" 3 | cidr_vpc = "192.168.0.0/16" 4 | cidr_instance_tenancy = "default" 5 | vpc_id = "${module.my_vpc.vpc_id}" 6 | cidr_subnet = "192.168.1.0/24" 7 | 8 | } 9 | 10 | module "my_ec2" { 11 | source = "../modules/ec2" 12 | instance_type = "t2.nano" 13 | ec2_name = "my_devEC2" 14 | subnet_id = "${module.my_vpc.subnet_id}" 15 | } 16 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/10_List_Count/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "Myec2"{ 2 | count = "${length(var.availability_zone)}" 3 | ami = "${var.ami}" 4 | instance_type = "${var.instance_type}" 5 | availability_zone = "${element(var.availability_zone, count.index)}" 6 | tags = { 7 | Name = "MyEC2_${element(var.availability_zone, count.index)}" 8 | } 9 | } 10 | output "Myec2" { 11 | value = "${aws_instance.Myec2}" 12 | } 13 | -------------------------------------------------------------------------------- /EKS/terraform/internet-gateway.tf: -------------------------------------------------------------------------------- 1 | # Resource: aws_internet_gateway 2 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway 3 | 4 | #allows vpc to get internet connection 5 | 6 | resource "aws_internet_gateway" "main" { 7 | # The VPC ID to create in. 8 | vpc_id = aws_vpc.main.id 9 | 10 | # A map of tags to assign to the resource. 11 | tags = { 12 | Name = "main" 13 | } 14 | depends_on = [ aws_vpc.main ] 15 | } 16 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/output.tf: -------------------------------------------------------------------------------- 1 | # output "vpc" { 2 | # value = "${aws_vpc.mainvpc}" 3 | # } 4 | output "vpc_id" { 5 | value = "${aws_vpc.mainvpc.id}" 6 | } 7 | 8 | # output "vpc_cidr" { 9 | # value = "${aws_vpc.mainvpc.cidr_block}" 10 | # } 11 | 12 | 13 | # output "public_subnet_id" { 14 | # value = "${aws_subnet.PublicSubnet_A.id}" 15 | # } 16 | 17 | # output "private_subnet_id" { 18 | # value = "${aws_subnet.PrivateSubnet_A.id}" 19 | # } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/modules/nw/var.tf: -------------------------------------------------------------------------------- 1 | variable "cidr_vpc" { 2 | default = "192.168.0.0/16" 3 | # 192.168.0.0 - 192.168.255.255 4 | } 5 | 6 | variable "cidr_instance_tenancy" { 7 | default = "dedicated" 8 | 9 | } 10 | 11 | variable "vpc_id" { 12 | default = {} 13 | } 14 | 15 | variable "cidr_subnet" { 16 | #192.168.1.0 - 192.168.1.255 17 | default = "192.168.1.0/24" 18 | } 19 | 20 | variable "az" { 21 | default = "eu-central-1a" 22 | } 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/prod/ec2_webapp.tf: -------------------------------------------------------------------------------- 1 | module "my_vpc" { 2 | source = "../modules/nw" 3 | cidr_vpc = "10.0.0.0/16" 4 | cidr_instance_tenancy = "default" 5 | vpc_id = "${module.my_vpc.vpc_id}" 6 | cidr_subnet = "10.0.1.0/24" 7 | az = "eu-central-1b" 8 | } 9 | 10 | module "my_ec2" { 11 | source = "../modules/ec2" 12 | instance_type = "t2.large" 13 | ec2_name = "my_prod_EC2" 14 | availability_zone = "eu-central-1b" 15 | subnet_id = "${module.my_vpc.subnet_id}" 16 | } 17 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/modules/ec2/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "myec2_forwebapp" { 2 | ami = "${var.ami}" 3 | instance_type = "${var.instance_type}" 4 | #ec2 is running in custom subnet which is in a custom vpc , 5 | #attaching this ec2 to a sg which is default and part of default vpc wont work 6 | 7 | #security_groups = ["default"] 8 | subnet_id = "${var.subnet_id}" 9 | tags = { 10 | Name = "${var.ec2_name}" 11 | } 12 | availability_zone = "${var.availability_zone}" 13 | } 14 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/var.tf: -------------------------------------------------------------------------------- 1 | variable "ami" { 2 | default = "ami-09cb21a1e29bcebf0" 3 | } 4 | 5 | variable "instance_type" { 6 | default = { 7 | default = "t2.micro", 8 | prod = "t2.large", 9 | dev = "t2.nano" 10 | } 11 | } 12 | 13 | variable "ec2_name" { 14 | default = { 15 | default = "", 16 | prod = "prod_ec2_workspace_demo", 17 | dev = "dev_ec2_workspace_demo" 18 | 19 | } 20 | } 21 | 22 | variable "availability_zone" { 23 | default = "eu-central-1a" 24 | } -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/5_Import/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "MyFirstEc2instance_from_terraform-EIP_demo1" { 2 | ami = "ami-09cb21a1e29bcebf0" 3 | instance_type = "t2.micro" 4 | tags = { 5 | Name = "EC2started_from_console_from_terraform_EIP_DEMO" 6 | } 7 | key_name = "testkey" 8 | 9 | } 10 | 11 | /* 12 | 13 | resource "aws_instance" "ec2_created_by_paul_manually" { 14 | ami = "ami-0b9094fa2b07038b8" 15 | instance_type = "t2.micro" 16 | tags = { 17 | Name = "EC2FROMPAUL1" 18 | } 19 | key_name = "testkey" 20 | 21 | } 22 | */ 23 | -------------------------------------------------------------------------------- /ECS/logs.tf: -------------------------------------------------------------------------------- 1 | # logs.tf 2 | 3 | # Set up CloudWatch group and log stream and retain logs for 30 days 4 | resource "aws_cloudwatch_log_group" "web_app_log_group" { 5 | name = "/ecs/web-app" 6 | retention_in_days = 30 7 | 8 | tags = { 9 | Name = "ecs_demo_terraform_course" 10 | } 11 | } 12 | 13 | resource "aws_cloudwatch_log_stream" "web_app_log_stream" { 14 | name = "web-applog-stream" 15 | log_group_name = aws_cloudwatch_log_group.web_app_log_group.name 16 | depends_on = [aws_cloudwatch_log_group.web_app_log_group] 17 | } 18 | 19 | -------------------------------------------------------------------------------- /EKS/k8s-consoledemo/nginx.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: nginx 5 | spec: 6 | selector: 7 | matchLabels: 8 | run: nginx 9 | replicas: 2 10 | template: 11 | metadata: 12 | labels: 13 | run: nginx 14 | spec: 15 | containers: 16 | - name: webserver # The name that this container will have. 17 | image: nginx:latest # The image on which it is based. 18 | ports: # The port(s) that will be open. 19 | - containerPort: 80 -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/output.tf: -------------------------------------------------------------------------------- 1 | # output "vpc" { 2 | # value = "${aws_vpc.mainvpc}" 3 | # } 4 | output "vpc_id" { 5 | value = "${aws_vpc.mainvpc.id}" 6 | } 7 | 8 | output "alb_dns" { 9 | value = "${aws_alb.webapp_load_balancer.dns_name}" 10 | } 11 | 12 | 13 | # output "vpc_cidr" { 14 | # value = "${aws_vpc.mainvpc.cidr_block}" 15 | # } 16 | 17 | 18 | # output "public_subnet_id" { 19 | # value = "${aws_subnet.PublicSubnet_A.id}" 20 | # } 21 | 22 | # output "private_subnet_id" { 23 | # value = "${aws_subnet.PrivateSubnet_A.id}" 24 | # } -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/output.tf: -------------------------------------------------------------------------------- 1 | # output "vpc" { 2 | # value = "${aws_vpc.mainvpc}" 3 | # } 4 | output "vpc_id" { 5 | value = "${aws_vpc.mainvpc.id}" 6 | } 7 | 8 | output "alb_dns" { 9 | value = "${aws_alb.webapp_load_balancer.dns_name}" 10 | } 11 | 12 | 13 | # output "vpc_cidr" { 14 | # value = "${aws_vpc.mainvpc.cidr_block}" 15 | # } 16 | 17 | 18 | # output "public_subnet_id" { 19 | # value = "${aws_subnet.PublicSubnet_A.id}" 20 | # } 21 | 22 | # output "private_subnet_id" { 23 | # value = "${aws_subnet.PrivateSubnet_A.id}" 24 | # } -------------------------------------------------------------------------------- /EKS/terraform/eips.tf: -------------------------------------------------------------------------------- 1 | 2 | # Resource: aws_eip 3 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip 4 | 5 | 6 | #public ip address for nat gateways 7 | resource "aws_eip" "nat1" { 8 | # EIP may require IGW to exist prior to association. 9 | # Use depends_on to set an explicit dependency on the IGW. 10 | depends_on = [aws_internet_gateway.main] 11 | } 12 | 13 | resource "aws_eip" "nat2" { 14 | # EIP may require IGW to exist prior to association. 15 | # Use depends_on to set an explicit dependency on the IGW. 16 | depends_on = [aws_internet_gateway.main] 17 | } 18 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/subnet.tf: -------------------------------------------------------------------------------- 1 | resource "aws_subnet" "PublicSubnet_A" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | cidr_block = "10.0.0.0/24" 4 | availability_zone = "us-east-1a" 5 | map_public_ip_on_launch = true 6 | 7 | tags = { 8 | Name = "PublicSubnet_A" 9 | } 10 | depends_on = [aws_vpc.mainvpc] 11 | } 12 | 13 | resource "aws_subnet" "PrivateSubnet_A" { 14 | vpc_id = "${aws_vpc.mainvpc.id}" 15 | cidr_block = "10.0.16.0/20" 16 | availability_zone = "us-east-1a" 17 | 18 | 19 | tags = { 20 | Name = "PrivateSubnet_A" 21 | } 22 | depends_on = [aws_vpc.mainvpc] 23 | } -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project/sg.tf: -------------------------------------------------------------------------------- 1 | resource "aws_security_group" "allow_http_only" { 2 | name = "allow_http" 3 | description = "Allow HTTP inbound traffic,Allow all outbound traffic" 4 | 5 | ingress { 6 | #http 7 | from_port = 80 8 | to_port = 80 9 | protocol = "TCP" 10 | cidr_blocks = ["0.0.0.0/0"] 11 | description = "allow http inbound" 12 | } 13 | 14 | egress { 15 | from_port = 0 16 | to_port = 0 17 | protocol = "-1" 18 | cidr_blocks = ["0.0.0.0/0"] 19 | description = "allow all traffic outbound" 20 | } 21 | } -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/sg.tf: -------------------------------------------------------------------------------- 1 | resource "aws_security_group" "allow_http_only" { 2 | name = "allow_http" 3 | description = "Allow HTTP inbound traffic,Allow all outbound traffic" 4 | 5 | ingress { 6 | #http 7 | from_port = 80 8 | to_port = 80 9 | protocol = "TCP" 10 | cidr_blocks = ["0.0.0.0/0"] 11 | description = "allow http inbound" 12 | } 13 | 14 | egress { 15 | from_port = 0 16 | to_port = 0 17 | protocol = "-1" 18 | cidr_blocks = ["0.0.0.0/0"] 19 | description = "allow all traffic outbound" 20 | } 21 | } -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/sg.tf: -------------------------------------------------------------------------------- 1 | resource "aws_security_group" "allow_http_only" { 2 | name = "allow_http" 3 | description = "Allow HTTP inbound traffic,Allow all outbound traffic" 4 | 5 | ingress { 6 | #http 7 | from_port = 80 8 | to_port = 80 9 | protocol = "TCP" 10 | cidr_blocks = ["0.0.0.0/0"] 11 | description = "allow http inbound" 12 | } 13 | 14 | egress { 15 | from_port = 0 16 | to_port = 0 17 | protocol = "-1" 18 | cidr_blocks = ["0.0.0.0/0"] 19 | description = "allow all traffic outbound" 20 | } 21 | } -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "front_end_ec2" { 2 | ami = "${var.ami}" 3 | instance_type = "${var.instance_type}" 4 | tags = { 5 | Name = "ec2_frontend" 6 | } 7 | subnet_id = "${var.subnetid}" 8 | vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 9 | 10 | } 11 | 12 | resource "aws_instance" "back_end_ec2" { 13 | ami = "${var.ami}" 14 | instance_type = "${var.instance_type}" 15 | tags = { 16 | Name = "ec2_backend" 17 | } 18 | subnet_id = "${var.subnetid}" 19 | vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/var.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | 3 | } 4 | 5 | variable "vpc_cidr" { 6 | 7 | } 8 | 9 | variable "instance_type" { 10 | default = "t2.micro" 11 | } 12 | 13 | variable "ami" { 14 | default = "ami-04cb4ca688797756f" 15 | 16 | } 17 | 18 | variable "public_subnet_cidr" { 19 | type = list 20 | 21 | } 22 | 23 | variable "private_subnet_cidr" { 24 | type = list 25 | } 26 | 27 | variable "availability_zone" { 28 | type = list 29 | } 30 | 31 | variable "public_subnet_names" { 32 | type = list 33 | 34 | } 35 | 36 | variable "private_subnet_names" { 37 | type = list 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "front_end_ec2" { 2 | ami = "ami-09cb21a1e29bcebf0" 3 | instance_type = "t2.micro" 4 | tags = { 5 | Name = "ec2_frontend" 6 | } 7 | subnet_id = "subnet-02561f643a450c0ce" 8 | vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 9 | 10 | } 11 | 12 | resource "aws_instance" "back_end_ec2" { 13 | ami = "ami-09cb21a1e29bcebf0" 14 | instance_type = "t2.micro" 15 | tags = { 16 | Name = "ec2_backend" 17 | } 18 | subnet_id = "subnet-02561f643a450c0ce" 19 | vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /AmazonElasticComputeCloud_EC2/ec2_lab/ec2.tf: -------------------------------------------------------------------------------- 1 | 2 | resource "aws_instance" "MyFirstEc2instance_from_terraform" { 3 | ami = "ami-09cb21a1e29bcebf0" 4 | instance_type = "t2.micro" 5 | tags = { 6 | Name = "EC2started_from_console_from_terraform" 7 | } 8 | key_name = "testkey" 9 | user_data = <<-EOF 10 | #!/bin/bash 11 | yum update -y 12 | yum install -y httpd 13 | systemctl start httpd.service 14 | systemctl enable httpd.service 15 | echo "Hi Friend , I am $(hostname -f) hosted by Terraform" > /var/www/html/index.html 16 | EOF 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/var.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | 3 | } 4 | 5 | variable "vpc_cidr" { 6 | 7 | } 8 | 9 | variable "instance_type" { 10 | default = "t2.micro" 11 | } 12 | 13 | variable "ami" { 14 | default = "ami-04cb4ca688797756f" 15 | 16 | } 17 | 18 | variable "public_subnet_cidr" { 19 | type = list 20 | 21 | } 22 | 23 | variable "private_subnet_cidr" { 24 | type = list 25 | } 26 | 27 | variable "availability_zone" { 28 | type = list 29 | } 30 | 31 | variable "public_subnet_names" { 32 | type = list 33 | 34 | } 35 | 36 | variable "private_subnet_names" { 37 | type = list 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/var.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | 3 | } 4 | 5 | variable "vpc_cidr" { 6 | 7 | } 8 | 9 | variable "instance_type" { 10 | default = "t2.micro" 11 | } 12 | 13 | variable "ami" { 14 | default = "ami-04cb4ca688797756f" 15 | 16 | } 17 | 18 | variable "public_subnet_cidr" { 19 | type = list 20 | 21 | } 22 | 23 | variable "private_subnet_cidr" { 24 | type = list 25 | } 26 | 27 | variable "availability_zone" { 28 | type = list 29 | } 30 | 31 | variable "public_subnet_names" { 32 | type = list 33 | 34 | } 35 | 36 | variable "private_subnet_names" { 37 | type = list 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/subnet.tf: -------------------------------------------------------------------------------- 1 | resource "aws_subnet" "PublicSubnet_A" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | cidr_block = "${var.public_subnet_cidr}" 4 | availability_zone = "${var.availability_zone}" 5 | map_public_ip_on_launch = true 6 | 7 | tags = { 8 | Name = "PublicSubnet_A" 9 | } 10 | depends_on = [aws_vpc.mainvpc] 11 | } 12 | 13 | resource "aws_subnet" "PrivateSubnet_A" { 14 | vpc_id = "${aws_vpc.mainvpc.id}" 15 | cidr_block = "${var.private_subnet_cidr}" 16 | availability_zone = "${var.availability_zone}" 17 | 18 | 19 | tags = { 20 | Name = "PrivateSubnet_A" 21 | } 22 | depends_on = [aws_vpc.mainvpc] 23 | } -------------------------------------------------------------------------------- /S3_EIP/ElasticIP_EIP/eip-lab/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "MyFirstEc2instance_from_terraform-EIP_demo" { 2 | ami = "ami-09cb21a1e29bcebf0" 3 | instance_type = "t2.micro" 4 | tags = { 5 | Name = "EC2started_from_console_from_terraform_EIP_DEMO" 6 | } 7 | key_name = "testkey" 8 | 9 | user_data = <<-EOF 10 | #!/bin/bash 11 | yum update -y 12 | yum install -y httpd 13 | systemctl start httpd.service 14 | systemctl enable httpd.service 15 | echo "Hi Friend , I am $(hostname -f) hosted by Terraform FOR eip demo" > /var/www/html/index.html 16 | EOF 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "my_ec2s" { 2 | count = "${length(var.ec2s)}" 3 | ami = "${var.ami}" 4 | instance_type = "${var.instance_type}" 5 | tags = { 6 | Name = "webapp_${element(var.ec2s, count.index)}" 7 | } 8 | subnet_id = "${var.subnetid}" 9 | vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 10 | 11 | } 12 | 13 | # resource "aws_instance" "back_end_ec2" { 14 | # ami = "${var.ami}" 15 | # instance_type = "${var.instance_type}" 16 | # tags = { 17 | # Name = "ec2_backend" 18 | # } 19 | # subnet_id = "${var.subnetid}" 20 | # vpc_security_group_ids = ["${aws_security_group.allow_http_only.id}"] 21 | 22 | # } 23 | 24 | -------------------------------------------------------------------------------- /BestPractices/14_remote-backend_lab/backend.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | backend "s3" { 3 | #Code for uploading .tfstate to Remote s3 bucket 4 | #Name of s3 bucket you created 5 | bucket = "remote-backend-demo-terraform" 6 | key = "remotedemo.tfstate" 7 | region = "us-east-1" 8 | #you have to mention keys here , it wont work if you put in providers.tf - open bug with terraform 9 | access_key = "pasteyouraccesskeyhere" 10 | secret_key = "pasteyoursecretkeyhere" 11 | # Code to lock the remote .tfstate 12 | #To lock the remote state file in S3 bucket , create a dynamodb table 13 | # and create a primary key 'LockID' 14 | dynamodb_table = "statelock_table_dynamo" 15 | } 16 | } 17 | 18 | #https://www.terraform.io/docs/backends/types/s3.html -------------------------------------------------------------------------------- /EKS/terraform/vpc.tf: -------------------------------------------------------------------------------- 1 | # Resource: aws_vpc 2 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc 3 | 4 | resource "aws_vpc" "main" { 5 | # The CIDR block for the VPC. 6 | cidr_block = "192.168.0.0/16" 7 | 8 | # Makes your instances shared on the host. 9 | instance_tenancy = "default" 10 | 11 | # Required for EKS. Enable/disable DNS support in the VPC. 12 | enable_dns_support = true 13 | 14 | # Required for EKS. Enable/disable DNS hostnames in the VPC. 15 | enable_dns_hostnames = true 16 | 17 | # Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. 18 | assign_generated_ipv6_cidr_block = false 19 | 20 | # A map of tags to assign to the resource. 21 | tags = { 22 | Name = "main" 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "PublicEC2" { 2 | ami = "ami-04cb4ca688797756f" 3 | instance_type = "t2.micro" 4 | vpc_security_group_ids = ["${aws_security_group.allow_ssh.id}"] 5 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 6 | key_name = "testkey" 7 | tags = { 8 | Name = "PublicEC2" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_subnet.PublicSubnet_A,aws_security_group.allow_ssh] 11 | } 12 | 13 | resource "aws_instance" "PrivateEC2" { 14 | ami = "ami-04cb4ca688797756f" 15 | instance_type = "t2.micro" 16 | vpc_security_group_ids = ["${aws_security_group.allow_ssh.id}"] 17 | subnet_id = "${aws_subnet.PrivateSubnet_A.id}" 18 | key_name = "testkey" 19 | tags = { 20 | Name = "PrivateEC2" 21 | } 22 | depends_on = [aws_vpc.mainvpc,aws_subnet.PrivateSubnet_A,aws_security_group.allow_ssh] 23 | } 24 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "mainvpc" { 2 | cidr_block = "${var.vpc_cidr}" 3 | instance_tenancy = "default" 4 | enable_dns_hostnames = true 5 | 6 | tags = { 7 | Name = "VPC_TF" 8 | } 9 | 10 | } 11 | resource "aws_internet_gateway" "IGW_TF" { 12 | vpc_id = "${aws_vpc.mainvpc.id}" 13 | 14 | tags = { 15 | Name = "IGW_TF" 16 | } 17 | depends_on = [aws_vpc.mainvpc] 18 | } 19 | 20 | resource "aws_eip" "EIP" { 21 | domain = "vpc" 22 | tags = { 23 | Name = "EIP" 24 | } 25 | 26 | } 27 | 28 | resource "aws_nat_gateway" "NATGW" { 29 | allocation_id = "${aws_eip.EIP.id}" 30 | subnet_id = "${aws_subnet.public_subnets[0].id}" 31 | 32 | tags = { 33 | Name = "NATGW" 34 | } 35 | depends_on = [aws_eip.EIP,aws_subnet.public_subnets] 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "PublicEC2" { 2 | ami = "${var.ami}" 3 | instance_type = "${var.instance_type}" 4 | vpc_security_group_ids = ["${aws_security_group.allow_ssh.id}"] 5 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 6 | key_name = "testkey" 7 | tags = { 8 | Name = "PublicEC2" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_subnet.PublicSubnet_A,aws_security_group.allow_ssh] 11 | } 12 | 13 | resource "aws_instance" "PrivateEC2" { 14 | ami = "${var.ami}" 15 | instance_type = "${var.instance_type}" 16 | vpc_security_group_ids = ["${aws_security_group.allow_ssh.id}"] 17 | subnet_id = "${aws_subnet.PrivateSubnet_A.id}" 18 | key_name = "testkey" 19 | tags = { 20 | Name = "PrivateEC2" 21 | } 22 | depends_on = [aws_vpc.mainvpc,aws_subnet.PrivateSubnet_A,aws_security_group.allow_ssh] 23 | } 24 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "mainvpc" { 2 | cidr_block = "${var.vpc_cidr}" 3 | instance_tenancy = "default" 4 | enable_dns_hostnames = true 5 | 6 | tags = { 7 | Name = "VPC_TF" 8 | } 9 | 10 | } 11 | resource "aws_internet_gateway" "IGW_TF" { 12 | vpc_id = "${aws_vpc.mainvpc.id}" 13 | 14 | tags = { 15 | Name = "IGW_TF" 16 | } 17 | depends_on = [aws_vpc.mainvpc] 18 | } 19 | 20 | resource "aws_eip" "EIP" { 21 | domain = "vpc" 22 | tags = { 23 | Name = "EIP" 24 | } 25 | 26 | } 27 | 28 | resource "aws_nat_gateway" "NATGW" { 29 | allocation_id = "${aws_eip.EIP.id}" 30 | subnet_id = "${aws_subnet.public_subnets[0].id}" 31 | 32 | tags = { 33 | Name = "NATGW" 34 | } 35 | depends_on = [aws_eip.EIP,aws_subnet.public_subnets] 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "mainvpc" { 2 | cidr_block = "${var.vpc_cidr}" 3 | instance_tenancy = "default" 4 | enable_dns_hostnames = true 5 | 6 | tags = { 7 | Name = "VPC_TF" 8 | } 9 | 10 | } 11 | resource "aws_internet_gateway" "IGW_TF" { 12 | vpc_id = "${aws_vpc.mainvpc.id}" 13 | 14 | tags = { 15 | Name = "IGW_TF" 16 | } 17 | depends_on = [aws_vpc.mainvpc] 18 | } 19 | 20 | resource "aws_eip" "EIP" { 21 | domain = "vpc" 22 | tags = { 23 | Name = "EIP" 24 | } 25 | 26 | } 27 | 28 | resource "aws_nat_gateway" "NATGW" { 29 | allocation_id = "${aws_eip.EIP.id}" 30 | subnet_id = "${aws_subnet.public_subnets[0].id}" 31 | 32 | tags = { 33 | Name = "NATGW" 34 | } 35 | depends_on = [aws_eip.EIP,aws_subnet.public_subnets] 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/modules/nw/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "my_vpc" { 2 | cidr_block = "${var.cidr_vpc}" 3 | instance_tenancy = "${var.cidr_instance_tenancy}" 4 | tags = { 5 | Name = "Custom Vpc" 6 | } 7 | } 8 | 9 | resource "aws_subnet" "my_subnet" { 10 | vpc_id = "${var.vpc_id}" 11 | cidr_block = "${var.cidr_subnet}" 12 | tags = { 13 | Name = "Subnet-module-demo" 14 | } 15 | availability_zone = "${var.az}" 16 | depends_on = [aws_vpc.my_vpc] 17 | } 18 | 19 | #This way prod/ec2_Webapp.tf can access this variables and pass it to vpc creation 20 | #prod/ec2_webapp.tf line5 21 | output "vpc_id" { 22 | value = "${aws_vpc.my_vpc.id}" 23 | } 24 | 25 | #This way prod/ec2_Webapp.tf can access this variables and pass it to subnet creation 26 | #prod/ec2_webapp.tf line14 27 | output "subnet_id" { 28 | value = "${aws_subnet.my_subnet.id}" 29 | } 30 | 31 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/subnet.tf: -------------------------------------------------------------------------------- 1 | resource "aws_subnet" "public_subnets" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | vpc_id = "${aws_vpc.mainvpc.id}" 4 | cidr_block = "${element(var.public_subnet_cidr, count.index)}" 5 | availability_zone = "${element(var.availability_zone, count.index)}" 6 | map_public_ip_on_launch = true 7 | 8 | tags = { 9 | Name = "${element(var.public_subnet_names, count.index)}" 10 | } 11 | depends_on = [aws_vpc.mainvpc] 12 | } 13 | 14 | resource "aws_subnet" "private_subnets" { 15 | count = "${length(var.private_subnet_cidr)}" 16 | vpc_id = "${aws_vpc.mainvpc.id}" 17 | cidr_block = "${element(var.private_subnet_cidr, count.index)}" 18 | availability_zone = "${element(var.availability_zone, count.index)}" 19 | 20 | 21 | tags = { 22 | Name = "${element(var.private_subnet_names, count.index)}" 23 | } 24 | depends_on = [aws_vpc.mainvpc] 25 | } -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/subnet.tf: -------------------------------------------------------------------------------- 1 | resource "aws_subnet" "public_subnets" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | vpc_id = "${aws_vpc.mainvpc.id}" 4 | cidr_block = "${element(var.public_subnet_cidr, count.index)}" 5 | availability_zone = "${element(var.availability_zone, count.index)}" 6 | map_public_ip_on_launch = true 7 | 8 | tags = { 9 | Name = "${element(var.public_subnet_names, count.index)}" 10 | } 11 | depends_on = [aws_vpc.mainvpc] 12 | } 13 | 14 | resource "aws_subnet" "private_subnets" { 15 | count = "${length(var.private_subnet_cidr)}" 16 | vpc_id = "${aws_vpc.mainvpc.id}" 17 | cidr_block = "${element(var.private_subnet_cidr, count.index)}" 18 | availability_zone = "${element(var.availability_zone, count.index)}" 19 | 20 | 21 | tags = { 22 | Name = "${element(var.private_subnet_names, count.index)}" 23 | } 24 | depends_on = [aws_vpc.mainvpc] 25 | } -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/subnet.tf: -------------------------------------------------------------------------------- 1 | resource "aws_subnet" "public_subnets" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | vpc_id = "${aws_vpc.mainvpc.id}" 4 | cidr_block = "${element(var.public_subnet_cidr, count.index)}" 5 | availability_zone = "${element(var.availability_zone, count.index)}" 6 | map_public_ip_on_launch = true 7 | 8 | tags = { 9 | Name = "${element(var.public_subnet_names, count.index)}" 10 | } 11 | depends_on = [aws_vpc.mainvpc] 12 | } 13 | 14 | resource "aws_subnet" "private_subnets" { 15 | count = "${length(var.private_subnet_cidr)}" 16 | vpc_id = "${aws_vpc.mainvpc.id}" 17 | cidr_block = "${element(var.private_subnet_cidr, count.index)}" 18 | availability_zone = "${element(var.availability_zone, count.index)}" 19 | 20 | 21 | tags = { 22 | Name = "${element(var.private_subnet_names, count.index)}" 23 | } 24 | depends_on = [aws_vpc.mainvpc] 25 | } -------------------------------------------------------------------------------- /ECS/alb.tf: -------------------------------------------------------------------------------- 1 | # alb.tf 2 | 3 | resource "aws_alb" "main" { 4 | name = "web-appload-balancer" 5 | subnets = aws_subnet.public.*.id 6 | security_groups = [aws_security_group.lb.id] 7 | tags = { 8 | Name = "ecs_demo_terraform_course" 9 | } 10 | } 11 | 12 | resource "aws_alb_target_group" "app" { 13 | name = "web-apptarget-group" 14 | port = 80 15 | protocol = "HTTP" 16 | vpc_id = aws_vpc.main.id 17 | target_type = "ip" 18 | 19 | health_check { 20 | healthy_threshold = "3" 21 | interval = "30" 22 | protocol = "HTTP" 23 | matcher = "200" 24 | timeout = "3" 25 | path = var.health_check_path 26 | unhealthy_threshold = "2" 27 | } 28 | tags = { 29 | Name = "ecs_demo_terraform_course" 30 | } 31 | } 32 | 33 | # Redirect all traffic from the ALB to the target group 34 | resource "aws_alb_listener" "front_end" { 35 | load_balancer_arn = aws_alb.main.id 36 | port = var.app_port 37 | protocol = "HTTP" 38 | 39 | default_action { 40 | target_group_arn = aws_alb_target_group.app.id 41 | type = "forward" 42 | } 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /EKS/terraform/nat-gateways.tf: -------------------------------------------------------------------------------- 1 | 2 | # Resource: aws_nat_gateway 3 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/nat_gateway 4 | 5 | #nat gateways allow private instances in private subnetwork to connect to internet 6 | #nat gateway translates private ip addresses to public ip addresses 7 | resource "aws_nat_gateway" "gw1" { 8 | # The Allocation ID of the Elastic IP address for the gateway. 9 | allocation_id = aws_eip.nat1.id 10 | 11 | # The Subnet ID of the subnet in which to place the gateway. 12 | subnet_id = aws_subnet.public_1.id 13 | 14 | # A map of tags to assign to the resource. 15 | tags = { 16 | Name = "NAT 1" 17 | } 18 | depends_on = [ 19 | aws_eip.nat1, 20 | aws_subnet.public_1 21 | ] 22 | } 23 | 24 | resource "aws_nat_gateway" "gw2" { 25 | # The Allocation ID of the Elastic IP address for the gateway. 26 | allocation_id = aws_eip.nat2.id 27 | 28 | # The Subnet ID of the subnet in which to place the gateway. 29 | subnet_id = aws_subnet.public_2.id 30 | 31 | # A map of tags to assign to the resource. 32 | tags = { 33 | Name = "NAT 2" 34 | } 35 | 36 | depends_on = [ 37 | aws_eip.nat2, 38 | aws_subnet.public_2 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /ECS/variables.tf: -------------------------------------------------------------------------------- 1 | # variables.tf 2 | 3 | variable "aws_region" { 4 | description = "The AWS region resources are created" 5 | default = "us-east-1" 6 | } 7 | 8 | variable "ecs_task_execution_role_name" { 9 | description = "ECS task execution role name" 10 | default = "EcsLabTaskExecutionRole" 11 | } 12 | 13 | variable "az_count" { 14 | description = "Number of AZs to cover in a given region" 15 | default = "2" 16 | } 17 | 18 | variable "app_image" { 19 | description = "Docker image to run in the ECS cluster" 20 | default = "439398671644.dkr.ecr.us-east-1.amazonaws.com/awslab:v1" 21 | } 22 | 23 | variable "app_port" { 24 | description = "Port exposed by the docker image to redirect traffic to" 25 | default = 3000 26 | } 27 | 28 | variable "app_count" { 29 | description = "Number of docker containers to run" 30 | default = 3 31 | } 32 | 33 | variable "health_check_path" { 34 | default = "/" 35 | } 36 | 37 | variable "fargate_cpu" { 38 | description = "Fargate instance CPU units to provision (1 vCPU = 1024 CPU units)" 39 | default = "1024" 40 | } 41 | 42 | variable "fargate_memory" { 43 | description = "Fargate instance memory to provision (in MiB)" 44 | default = "2048" 45 | } 46 | 47 | -------------------------------------------------------------------------------- /EKS/steps.txt: -------------------------------------------------------------------------------- 1 | 2 | eksroles -> select eks and attach following policies 3 | AmazonEKSClusterPolicy 4 | workernode roles -> select ec2 and attach following policies 5 | AmazonEC2ContainerRegistryReadOnly , AmazonEKS_CNI_Policy , AmazonEKSWorkerNodePolicy 6 | 7 | 8 | create eks cluster 9 | install aws cli ; aws configure # # https://aws.amazon.com/cli/ 10 | check aws commands are working 11 | aws iam list-users 12 | 13 | install kubectl #https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ 14 | install aws-iam-authenticator #https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html 15 | 16 | 17 | aws eks update-kubeconfig --region us-east-1 --name eks 18 | 19 | export KUBECONFIG=~/.kube/config 20 | kubectl get svc 21 | kubectl create -f nginx.yaml 22 | 23 | 24 | kubectl get svc -o wide 25 | kubectl get nodes --watch 26 | kubectl get deploy 27 | kubectl get pods 28 | 29 | kubectl create -f nginx-svc.yaml 30 | 31 | kubectl describe svc nginx 32 | 33 | # to update 34 | kubectl scale --replicas=3 -f nginx.yaml 35 | kubectl apply -f nginx.yaml 36 | 37 | # to delete 38 | kubectl delete -f nginx.yaml 39 | kubectl delete svc nginx 40 | 41 | https://kubernetes.io/docs/reference/kubectl/cheatsheet/ 42 | 43 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/routetable.tf: -------------------------------------------------------------------------------- 1 | resource "aws_route_table" "PublicRouteTable" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | route { 4 | cidr_block = "0.0.0.0/0" 5 | gateway_id = "${aws_internet_gateway.IGW_TF.id}" 6 | } 7 | tags = { 8 | Name = "PublicRouteTable" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_internet_gateway.IGW_TF] 11 | } 12 | 13 | 14 | resource "aws_route_table_association" "publicroutetableassociation" { 15 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 16 | route_table_id = "${aws_route_table.PublicRouteTable.id}" 17 | depends_on = [aws_subnet.PublicSubnet_A,aws_route_table.PublicRouteTable] 18 | } 19 | 20 | resource "aws_route_table" "PrivateRouteTable" { 21 | vpc_id = "${aws_vpc.mainvpc.id}" 22 | route { 23 | cidr_block = "0.0.0.0/0" 24 | gateway_id = "${aws_nat_gateway.NATGW.id}" 25 | } 26 | tags = { 27 | Name = "PrivateRouteTable" 28 | } 29 | depends_on = [aws_vpc.mainvpc,aws_nat_gateway.NATGW] 30 | } 31 | 32 | resource "aws_route_table_association" "privateroutetableassociation" { 33 | subnet_id = "${aws_subnet.PrivateSubnet_A.id}" 34 | route_table_id = "${aws_route_table.PrivateRouteTable.id}" 35 | depends_on = [aws_subnet.PrivateSubnet_A,aws_route_table.PrivateRouteTable] 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ECS/roles.tf: -------------------------------------------------------------------------------- 1 | # ECS task execution role data 2 | data "aws_iam_policy_document" "ecs_task_execution_role" { 3 | version = "2012-10-17" 4 | statement { 5 | sid = "" 6 | effect = "Allow" 7 | actions = ["sts:AssumeRole"] 8 | 9 | principals { 10 | type = "Service" 11 | identifiers = ["ecs-tasks.amazonaws.com"] 12 | } 13 | } 14 | 15 | # statement { 16 | # sid = "AllowPullECR" 17 | # effect = "Allow" 18 | # actions = [ 19 | # "ecr:GetDownloadUrlForLayer", 20 | # "ecr:BatchGetImage", 21 | # "ecr:BatchCheckLayerAvailability" 22 | # ] 23 | 24 | # principals { 25 | # type = "Service" 26 | # identifiers = ["ecs-tasks.amazonaws.com"] 27 | # } 28 | # } 29 | } 30 | 31 | # ECS task execution role 32 | resource "aws_iam_role" "ecs_task_execution_role" { 33 | name = var.ecs_task_execution_role_name 34 | assume_role_policy = data.aws_iam_policy_document.ecs_task_execution_role.json 35 | 36 | } 37 | 38 | # ECS task execution role policy attachment 39 | resource "aws_iam_role_policy_attachment" "ecs_task_execution_role" { 40 | role = aws_iam_role.ecs_task_execution_role.name 41 | policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" 42 | } -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/routetable.tf: -------------------------------------------------------------------------------- 1 | resource "aws_route_table" "PublicRouteTable" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | route { 4 | cidr_block = "0.0.0.0/0" 5 | gateway_id = "${aws_internet_gateway.IGW_TF.id}" 6 | } 7 | tags = { 8 | Name = "PublicRouteTable" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_internet_gateway.IGW_TF] 11 | } 12 | 13 | 14 | resource "aws_route_table_association" "publicroutetableassociation" { 15 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 16 | route_table_id = "${aws_route_table.PublicRouteTable.id}" 17 | depends_on = [aws_subnet.PublicSubnet_A,aws_route_table.PublicRouteTable] 18 | } 19 | 20 | resource "aws_route_table" "PrivateRouteTable" { 21 | vpc_id = "${aws_vpc.mainvpc.id}" 22 | route { 23 | cidr_block = "0.0.0.0/0" 24 | gateway_id = "${aws_nat_gateway.NATGW.id}" 25 | } 26 | tags = { 27 | Name = "PrivateRouteTable" 28 | } 29 | depends_on = [aws_vpc.mainvpc,aws_nat_gateway.NATGW] 30 | } 31 | 32 | resource "aws_route_table_association" "privateroutetableassociation" { 33 | subnet_id = "${aws_subnet.PrivateSubnet_A.id}" 34 | route_table_id = "${aws_route_table.PrivateRouteTable.id}" 35 | depends_on = [aws_subnet.PrivateSubnet_A,aws_route_table.PrivateRouteTable] 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ECS/security.tf: -------------------------------------------------------------------------------- 1 | # security.tf 2 | 3 | # ALB Security Group: Edit to restrict access to the application 4 | resource "aws_security_group" "lb" { 5 | name = "web-appload-balancer-security-group" 6 | description = "controls access to the ALB" 7 | vpc_id = aws_vpc.main.id 8 | 9 | ingress { 10 | protocol = "tcp" 11 | from_port = var.app_port 12 | to_port = var.app_port 13 | cidr_blocks = ["0.0.0.0/0"] 14 | } 15 | 16 | egress { 17 | protocol = "-1" 18 | from_port = 0 19 | to_port = 0 20 | cidr_blocks = ["0.0.0.0/0"] 21 | } 22 | tags = { 23 | Name = "ecs_demo_terraform_course" 24 | } 25 | } 26 | 27 | # Traffic to the ECS cluster should only come from the ALB 28 | resource "aws_security_group" "ecs_tasks" { 29 | name = "web-appecs-tasks-security-group" 30 | description = "allow inbound access from the ALB only" 31 | vpc_id = aws_vpc.main.id 32 | 33 | ingress { 34 | protocol = "tcp" 35 | from_port = var.app_port 36 | to_port = var.app_port 37 | security_groups = [aws_security_group.lb.id] 38 | } 39 | 40 | egress { 41 | protocol = "-1" 42 | from_port = 0 43 | to_port = 0 44 | cidr_blocks = ["0.0.0.0/0"] 45 | } 46 | tags = { 47 | Name = "ecs_demo_terraform_course" 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /EKS/k8s-terraform/app.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: nginx 6 | labels: 7 | app: nginx 8 | spec: 9 | replicas: 5 10 | selector: 11 | matchLabels: 12 | app: nginx 13 | template: 14 | metadata: 15 | labels: 16 | app: nginx 17 | spec: 18 | containers: 19 | - name: nginx 20 | image: nginx:latest 21 | ports: 22 | - containerPort: 80 23 | --- 24 | apiVersion: v1 25 | kind: Service 26 | metadata: 27 | name: internal-nginx-service 28 | annotations: 29 | service.beta.kubernetes.io/aws-load-balancer-type: nlb 30 | service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: 'true' 31 | service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0 #public or private loadbalancer 32 | spec: 33 | selector: 34 | app: nginx 35 | type: LoadBalancer 36 | ports: 37 | - protocol: TCP 38 | port: 80 39 | --- 40 | apiVersion: v1 41 | kind: Service 42 | metadata: 43 | name: external-nginx-service 44 | annotations: 45 | service.beta.kubernetes.io/aws-load-balancer-type: nlb 46 | service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: 'true' 47 | spec: 48 | selector: 49 | app: nginx 50 | type: LoadBalancer 51 | ports: 52 | - protocol: TCP 53 | port: 80 54 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/routetable.tf: -------------------------------------------------------------------------------- 1 | resource "aws_route_table" "PublicRouteTable" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | route { 4 | cidr_block = "0.0.0.0/0" 5 | gateway_id = "${aws_internet_gateway.IGW_TF.id}" 6 | } 7 | tags = { 8 | Name = "PublicRouteTable" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_internet_gateway.IGW_TF] 11 | } 12 | 13 | 14 | resource "aws_route_table_association" "publicroutetableassociation" { 15 | count = "${length(var.public_subnet_cidr)}" 16 | subnet_id = "${element(aws_subnet.public_subnets.*.id, count.index)}" 17 | route_table_id = "${aws_route_table.PublicRouteTable.id}" 18 | depends_on = [aws_subnet.public_subnets,aws_route_table.PublicRouteTable] 19 | } 20 | 21 | resource "aws_route_table" "PrivateRouteTable" { 22 | vpc_id = "${aws_vpc.mainvpc.id}" 23 | route { 24 | cidr_block = "0.0.0.0/0" 25 | gateway_id = "${aws_nat_gateway.NATGW.id}" 26 | } 27 | tags = { 28 | Name = "PrivateRouteTable" 29 | } 30 | depends_on = [aws_vpc.mainvpc,aws_nat_gateway.NATGW] 31 | } 32 | 33 | resource "aws_route_table_association" "privateroutetableassociation" { 34 | count = "${length(var.private_subnet_cidr)}" 35 | subnet_id = "${element(aws_subnet.private_subnets.*.id, count.index)}" 36 | route_table_id = "${aws_route_table.PrivateRouteTable.id}" 37 | depends_on = [aws_subnet.private_subnets,aws_route_table.PrivateRouteTable] 38 | } 39 | 40 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/routetable.tf: -------------------------------------------------------------------------------- 1 | resource "aws_route_table" "PublicRouteTable" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | route { 4 | cidr_block = "0.0.0.0/0" 5 | gateway_id = "${aws_internet_gateway.IGW_TF.id}" 6 | } 7 | tags = { 8 | Name = "PublicRouteTable" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_internet_gateway.IGW_TF] 11 | } 12 | 13 | 14 | resource "aws_route_table_association" "publicroutetableassociation" { 15 | count = "${length(var.public_subnet_cidr)}" 16 | subnet_id = "${element(aws_subnet.public_subnets.*.id, count.index)}" 17 | route_table_id = "${aws_route_table.PublicRouteTable.id}" 18 | depends_on = [aws_subnet.public_subnets,aws_route_table.PublicRouteTable] 19 | } 20 | 21 | resource "aws_route_table" "PrivateRouteTable" { 22 | vpc_id = "${aws_vpc.mainvpc.id}" 23 | route { 24 | cidr_block = "0.0.0.0/0" 25 | gateway_id = "${aws_nat_gateway.NATGW.id}" 26 | } 27 | tags = { 28 | Name = "PrivateRouteTable" 29 | } 30 | depends_on = [aws_vpc.mainvpc,aws_nat_gateway.NATGW] 31 | } 32 | 33 | resource "aws_route_table_association" "privateroutetableassociation" { 34 | count = "${length(var.private_subnet_cidr)}" 35 | subnet_id = "${element(aws_subnet.private_subnets.*.id, count.index)}" 36 | route_table_id = "${aws_route_table.PrivateRouteTable.id}" 37 | depends_on = [aws_subnet.private_subnets,aws_route_table.PrivateRouteTable] 38 | } 39 | 40 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/routetable.tf: -------------------------------------------------------------------------------- 1 | resource "aws_route_table" "PublicRouteTable" { 2 | vpc_id = "${aws_vpc.mainvpc.id}" 3 | route { 4 | cidr_block = "0.0.0.0/0" 5 | gateway_id = "${aws_internet_gateway.IGW_TF.id}" 6 | } 7 | tags = { 8 | Name = "PublicRouteTable" 9 | } 10 | depends_on = [aws_vpc.mainvpc,aws_internet_gateway.IGW_TF] 11 | } 12 | 13 | 14 | resource "aws_route_table_association" "publicroutetableassociation" { 15 | count = "${length(var.public_subnet_cidr)}" 16 | subnet_id = "${element(aws_subnet.public_subnets.*.id, count.index)}" 17 | route_table_id = "${aws_route_table.PublicRouteTable.id}" 18 | depends_on = [aws_subnet.public_subnets,aws_route_table.PublicRouteTable] 19 | } 20 | 21 | resource "aws_route_table" "PrivateRouteTable" { 22 | vpc_id = "${aws_vpc.mainvpc.id}" 23 | route { 24 | cidr_block = "0.0.0.0/0" 25 | gateway_id = "${aws_nat_gateway.NATGW.id}" 26 | } 27 | tags = { 28 | Name = "PrivateRouteTable" 29 | } 30 | depends_on = [aws_vpc.mainvpc,aws_nat_gateway.NATGW] 31 | } 32 | 33 | resource "aws_route_table_association" "privateroutetableassociation" { 34 | count = "${length(var.private_subnet_cidr)}" 35 | subnet_id = "${element(aws_subnet.private_subnets.*.id, count.index)}" 36 | route_table_id = "${aws_route_table.PrivateRouteTable.id}" 37 | depends_on = [aws_subnet.private_subnets,aws_route_table.PrivateRouteTable] 38 | } 39 | 40 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "mainvpc" { 2 | cidr_block = "10.0.0.0/16" 3 | instance_tenancy = "default" 4 | enable_dns_hostnames = true 5 | 6 | tags = { 7 | Name = "VPC_TF" 8 | } 9 | 10 | } 11 | 12 | resource "aws_security_group" "allow_ssh" { 13 | name = "allow_ssh" 14 | description = "Allow SSH inbound traffic/ Allow all outbound traffic" 15 | vpc_id = "${aws_vpc.mainvpc.id}" 16 | 17 | ingress { 18 | from_port = 22 19 | to_port = 22 20 | protocol = "tcp" 21 | cidr_blocks = ["0.0.0.0/0"] 22 | } 23 | egress { 24 | from_port = 0 25 | to_port = 0 26 | protocol = "-1" 27 | cidr_blocks = ["0.0.0.0/0"] 28 | } 29 | 30 | tags = { 31 | Name = "SecurityGroup_TF" 32 | } 33 | 34 | depends_on = [aws_vpc.mainvpc] 35 | } 36 | 37 | resource "aws_internet_gateway" "IGW_TF" { 38 | vpc_id = "${aws_vpc.mainvpc.id}" 39 | 40 | tags = { 41 | Name = "IGW_TF" 42 | } 43 | depends_on = [aws_vpc.mainvpc] 44 | } 45 | 46 | resource "aws_eip" "EIP" { 47 | domain = "vpc" 48 | tags = { 49 | Name = "EIP" 50 | } 51 | 52 | } 53 | 54 | resource "aws_nat_gateway" "NATGW" { 55 | allocation_id = "${aws_eip.EIP.id}" 56 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 57 | 58 | tags = { 59 | Name = "NATGW" 60 | } 61 | depends_on = [aws_eip.EIP,aws_subnet.PublicSubnet_A] 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /S3_EIP/ElasticIP_EIP/eip-lab/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.16.2" 6 | hashes = [ 7 | "h1:FqVVe7Y/xGRO8lE6lyPYswLv1jORORxWNK1CtodVATY=", 8 | "zh:00697204583b32e880abe73eb37814f34c07c9b3294f5c85755ee02cbdfcaa92", 9 | "zh:1345d8b2ab9ddcf25d313152f17fd139a1d570229542949dc819184bf851305e", 10 | "zh:14a0d2de839d26b8607078de059be328a47d60cee95756fb1c1500b3c6b552a2", 11 | "zh:15f7c1f561df4e596f69d983014850c6e29c7025921a1d45150e23162e9bbfa7", 12 | "zh:3587de4370db87b0955e08bb521cc8b15ba3c616a4a22238b2934bc7d7e3dc3e", 13 | "zh:4e98960e8e1ad18a079e83e7a86806a2dd7a28ac67a100471776e424f5d02140", 14 | "zh:674eaa30c90410a0d0c2ef52f5ad47c74f186fe2e7e03475bfeca5bcda67a490", 15 | "zh:683eb032f5dce2673d25c48c50e1fe88cbb0d255640babad496767f3db5993fd", 16 | "zh:6f157679a955ff43c468169bcb412b555bbd6b9664a61a4e71019df307e80f1c", 17 | "zh:720c6c3873b36e361477f0ed2920803e35773cb652d51c757b3581d0db08e6e5", 18 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 19 | "zh:9e86cc849446901c77c05d6735271befb443b18fd84890b00aaef6a11ab54212", 20 | "zh:a02ecab0f8d68a7f7ed6b2e37a53999d234606e5b8f65f2c3bcfb82826131f00", 21 | "zh:a9d545217cd339ddfb0b9061a89e82022d727d654bddac294eb0d544a3367fbc", 22 | "zh:b5a495582adb2c92cff67013c9083f7a08b9295e29af816c541177eb989a20ee", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /BestPractices/14_remote-backend_lab/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/5_Import/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/vpc.tf: -------------------------------------------------------------------------------- 1 | resource "aws_vpc" "mainvpc" { 2 | cidr_block = "${var.vpc_cidr}" 3 | instance_tenancy = "default" 4 | enable_dns_hostnames = true 5 | 6 | tags = { 7 | Name = "VPC_TF" 8 | } 9 | 10 | } 11 | 12 | resource "aws_security_group" "allow_ssh" { 13 | name = "allow_ssh" 14 | description = "Allow SSH inbound traffic/ Allow all outbound traffic" 15 | vpc_id = "${aws_vpc.mainvpc.id}" 16 | 17 | ingress { 18 | from_port = 22 19 | to_port = 22 20 | protocol = "tcp" 21 | cidr_blocks = ["0.0.0.0/0"] 22 | } 23 | egress { 24 | from_port = 0 25 | to_port = 0 26 | protocol = "-1" 27 | cidr_blocks = ["0.0.0.0/0"] 28 | } 29 | 30 | tags = { 31 | Name = "SecurityGroup_TF" 32 | } 33 | 34 | depends_on = [aws_vpc.mainvpc] 35 | } 36 | 37 | resource "aws_internet_gateway" "IGW_TF" { 38 | vpc_id = "${aws_vpc.mainvpc.id}" 39 | 40 | tags = { 41 | Name = "IGW_TF" 42 | } 43 | depends_on = [aws_vpc.mainvpc] 44 | } 45 | 46 | resource "aws_eip" "EIP" { 47 | domain = "vpc" 48 | tags = { 49 | Name = "EIP" 50 | } 51 | 52 | } 53 | 54 | resource "aws_nat_gateway" "NATGW" { 55 | allocation_id = "${aws_eip.EIP.id}" 56 | subnet_id = "${aws_subnet.PublicSubnet_A.id}" 57 | 58 | tags = { 59 | Name = "NATGW" 60 | } 61 | depends_on = [aws_eip.EIP,aws_subnet.PublicSubnet_A] 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/dev/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/8_Workspace/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /VPC_EC2_Project/11_VPC_Project_Refractor/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules/prod/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /S3_EIP/AmazonSimpleStorageService_S3/s3-lab/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.16.2" 6 | hashes = [ 7 | "h1:FqVVe7Y/xGRO8lE6lyPYswLv1jORORxWNK1CtodVATY=", 8 | "zh:00697204583b32e880abe73eb37814f34c07c9b3294f5c85755ee02cbdfcaa92", 9 | "zh:1345d8b2ab9ddcf25d313152f17fd139a1d570229542949dc819184bf851305e", 10 | "zh:14a0d2de839d26b8607078de059be328a47d60cee95756fb1c1500b3c6b552a2", 11 | "zh:15f7c1f561df4e596f69d983014850c6e29c7025921a1d45150e23162e9bbfa7", 12 | "zh:3587de4370db87b0955e08bb521cc8b15ba3c616a4a22238b2934bc7d7e3dc3e", 13 | "zh:4e98960e8e1ad18a079e83e7a86806a2dd7a28ac67a100471776e424f5d02140", 14 | "zh:674eaa30c90410a0d0c2ef52f5ad47c74f186fe2e7e03475bfeca5bcda67a490", 15 | "zh:683eb032f5dce2673d25c48c50e1fe88cbb0d255640babad496767f3db5993fd", 16 | "zh:6f157679a955ff43c468169bcb412b555bbd6b9664a61a4e71019df307e80f1c", 17 | "zh:720c6c3873b36e361477f0ed2920803e35773cb652d51c757b3581d0db08e6e5", 18 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 19 | "zh:9e86cc849446901c77c05d6735271befb443b18fd84890b00aaef6a11ab54212", 20 | "zh:a02ecab0f8d68a7f7ed6b2e37a53999d234606e5b8f65f2c3bcfb82826131f00", 21 | "zh:a9d545217cd339ddfb0b9061a89e82022d727d654bddac294eb0d544a3367fbc", 22 | "zh:b5a495582adb2c92cff67013c9083f7a08b9295e29af816c541177eb989a20ee", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/dev/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/7_Modules_Part2/prod/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor1/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.22.0" 6 | hashes = [ 7 | "h1:q8JCm3r/lVFQPhTPNMB0O1qEuLx/RNeJdY3gTTLwFh8=", 8 | "zh:09b8475cd519c945423b1e1183b71a4209dd2927e0d289a88c5abeecb53c1753", 9 | "zh:2448e0c3ce9b991a5dd70f6a42d842366a6a2460cf63b31fb9bc5d2cc92ced19", 10 | "zh:3b9fc2bf6714a9a9ab25eae3e56cead3d3917bc1b6d8b9fb3111c4198a790c72", 11 | "zh:4fbd28ad5380529a36c54d7a96c9768df1288c625d28b8fa3a50d4fc2176ef0f", 12 | "zh:54d550f190702a7edc2d459952d025e259a8c0b0ff7df3f15bbcc148539214bf", 13 | "zh:638f406d084ac96f3a0b0a5ce8aa71a5a2a781a56ba96e3a235d3982b89eef0d", 14 | "zh:69d4c175b13b6916b5c9398172cc384e7af46cb737b45870ab9907f12e82a28a", 15 | "zh:81edec181a67255d25caf5e7ffe6d5e8f9373849b9e8f5e0705f277640abb18e", 16 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 17 | "zh:a66efb2b3cf7be8116728ae5782d7550f23f3719da2ed3c10228d29c44b7dc84", 18 | "zh:ae754478d0bfa42195d16cf46091fab7c1c075ebc965d919338e36aed45add78", 19 | "zh:e0603ad0061c43aa1cb52740b1e700b8afb55667d7ee01c1cc1ceb6f983d4c9d", 20 | "zh:e4cb701d0185884eed0492a66eff17251f5b4971d30e81acd5e0a55627059fc8", 21 | "zh:f7db2fcf69679925dde1ae326526242fd61ba1f83f614b1f6d9d68c925417e51", 22 | "zh:fef331b9b62bc26d900ae937cc662281ff30794edf48aebfe8997d0e16835f6d", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project_Refractor2/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.22.0" 6 | hashes = [ 7 | "h1:q8JCm3r/lVFQPhTPNMB0O1qEuLx/RNeJdY3gTTLwFh8=", 8 | "zh:09b8475cd519c945423b1e1183b71a4209dd2927e0d289a88c5abeecb53c1753", 9 | "zh:2448e0c3ce9b991a5dd70f6a42d842366a6a2460cf63b31fb9bc5d2cc92ced19", 10 | "zh:3b9fc2bf6714a9a9ab25eae3e56cead3d3917bc1b6d8b9fb3111c4198a790c72", 11 | "zh:4fbd28ad5380529a36c54d7a96c9768df1288c625d28b8fa3a50d4fc2176ef0f", 12 | "zh:54d550f190702a7edc2d459952d025e259a8c0b0ff7df3f15bbcc148539214bf", 13 | "zh:638f406d084ac96f3a0b0a5ce8aa71a5a2a781a56ba96e3a235d3982b89eef0d", 14 | "zh:69d4c175b13b6916b5c9398172cc384e7af46cb737b45870ab9907f12e82a28a", 15 | "zh:81edec181a67255d25caf5e7ffe6d5e8f9373849b9e8f5e0705f277640abb18e", 16 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 17 | "zh:a66efb2b3cf7be8116728ae5782d7550f23f3719da2ed3c10228d29c44b7dc84", 18 | "zh:ae754478d0bfa42195d16cf46091fab7c1c075ebc965d919338e36aed45add78", 19 | "zh:e0603ad0061c43aa1cb52740b1e700b8afb55667d7ee01c1cc1ceb6f983d4c9d", 20 | "zh:e4cb701d0185884eed0492a66eff17251f5b4971d30e81acd5e0a55627059fc8", 21 | "zh:f7db2fcf69679925dde1ae326526242fd61ba1f83f614b1f6d9d68c925417e51", 22 | "zh:fef331b9b62bc26d900ae937cc662281ff30794edf48aebfe8997d0e16835f6d", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/asg.tf: -------------------------------------------------------------------------------- 1 | resource "aws_launch_configuration" "worker" { 2 | name_prefix = "Autoscaled_TF-" 3 | 4 | image_id = "${var.ami}" 5 | instance_type = "${var.instance_type}" 6 | security_groups = ["${aws_security_group.elb_security_group.id}"] 7 | associate_public_ip_address = true 8 | key_name = "testkey-us" 9 | user_data = <<-EOF 10 | #!/bin/bash 11 | yum update -y 12 | yum install -y httpd 13 | systemctl start httpd.service 14 | systemctl enable httpd.service 15 | echo "Hi Friend I am public EC2 launched from Autoscaling!!!! : $(hostname -f)" > /var/www/html/index.html 16 | EOF 17 | 18 | lifecycle { 19 | create_before_destroy = true 20 | } 21 | } 22 | 23 | resource "aws_autoscaling_group" "worker" { 24 | name = "my_asg_tf_${aws_launch_configuration.worker.name}" 25 | min_size = 1 26 | desired_capacity = 1 27 | max_size = 3 28 | vpc_zone_identifier = "${aws_subnet.public_subnets.*.id}" 29 | launch_configuration = "${aws_launch_configuration.worker.name}" 30 | health_check_type = "ELB" 31 | 32 | target_group_arns = ["${aws_alb_target_group.alb_front_http.arn}"] 33 | default_cooldown = 30 34 | health_check_grace_period = 30 35 | # Required to redeploy without an outage. 36 | lifecycle { 37 | create_before_destroy = true 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ECR/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /ECS/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /AmazonElasticComputeCloud_EC2/ec2_lab/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "4.67.0" 6 | hashes = [ 7 | "h1:5Zfo3GfRSWBaXs4TGQNOflr1XaYj6pRnVJLX5VAjFX4=", 8 | "h1:xzpipYzqP0dTwotCNTD+4DsIPOGoXlYsX3nJDqHRrZM=", 9 | "zh:0843017ecc24385f2b45f2c5fce79dc25b258e50d516877b3affee3bef34f060", 10 | "zh:19876066cfa60de91834ec569a6448dab8c2518b8a71b5ca870b2444febddac6", 11 | "zh:24995686b2ad88c1ffaa242e36eee791fc6070e6144f418048c4ce24d0ba5183", 12 | "zh:4a002990b9f4d6d225d82cb2fb8805789ffef791999ee5d9cb1fef579aeff8f1", 13 | "zh:559a2b5ace06b878c6de3ecf19b94fbae3512562f7a51e930674b16c2f606e29", 14 | "zh:6a07da13b86b9753b95d4d8218f6dae874cf34699bca1470d6effbb4dee7f4b7", 15 | "zh:768b3bfd126c3b77dc975c7c0e5db3207e4f9997cf41aa3385c63206242ba043", 16 | "zh:7be5177e698d4b547083cc738b977742d70ed68487ce6f49ecd0c94dbf9d1362", 17 | "zh:8b562a818915fb0d85959257095251a05c76f3467caa3ba95c583ba5fe043f9b", 18 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 19 | "zh:9c385d03a958b54e2afd5279cd8c7cbdd2d6ca5c7d6a333e61092331f38af7cf", 20 | "zh:b3ca45f2821a89af417787df8289cb4314b273d29555ad3b2a5ab98bb4816b3b", 21 | "zh:da3c317f1db2469615ab40aa6baba63b5643bae7110ff855277a1fb9d8eb4f2c", 22 | "zh:dc6430622a8dc5cdab359a8704aec81d3825ea1d305bbb3bbd032b1c6adfae0c", 23 | "zh:fac0d2ddeadf9ec53da87922f666e1e73a603a611c57bcbc4b86ac2821619b1d", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /BackEnd_FrontEnd_Project/4_be-fe_Project/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_lab_1/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:IOvWK6rZ2e8AubIWAfKzqI+9AcG+QNPcMOZlujhO840=", 8 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 9 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 10 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 11 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 12 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 13 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 14 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 15 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 16 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 17 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 18 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 19 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 22 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 23 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /EKS/terraform/route-table-association.tf: -------------------------------------------------------------------------------- 1 | # Resource: aws_route_table_association 2 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association 3 | 4 | resource "aws_route_table_association" "public1" { 5 | # The subnet ID to create an association. 6 | subnet_id = aws_subnet.public_1.id 7 | 8 | # The ID of the routing table to associate with. 9 | route_table_id = aws_route_table.public.id 10 | depends_on = [ 11 | aws_subnet.public_1, 12 | aws_route_table.public ] 13 | } 14 | 15 | resource "aws_route_table_association" "public2" { 16 | # The subnet ID to create an association. 17 | subnet_id = aws_subnet.public_2.id 18 | 19 | # The ID of the routing table to associate with. 20 | route_table_id = aws_route_table.public.id 21 | 22 | depends_on = [ 23 | aws_subnet.public_2, 24 | aws_route_table.public ] 25 | } 26 | 27 | resource "aws_route_table_association" "private1" { 28 | # The subnet ID to create an association. 29 | subnet_id = aws_subnet.private_1.id 30 | 31 | # The ID of the routing table to associate with. 32 | route_table_id = aws_route_table.private1.id 33 | depends_on = [ 34 | aws_subnet.private_1, 35 | aws_route_table.private1 ] 36 | } 37 | 38 | resource "aws_route_table_association" "private2" { 39 | # The subnet ID to create an association. 40 | subnet_id = aws_subnet.private_2.id 41 | 42 | # The ID of the routing table to associate with. 43 | route_table_id = aws_route_table.private2.id 44 | depends_on = [ 45 | aws_subnet.private_2, 46 | aws_route_table.private2 ] 47 | } 48 | -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/6_provisioners/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "MyfirstEC2instance_Terraform" { 2 | 3 | ami = "ami-09cb21a1e29bcebf0" 4 | instance_type = "t2.micro" 5 | key_name = "demokey" 6 | tags = { 7 | Name = "MyfirstEC2instance_Terraform" 8 | } 9 | provisioner "local-exec" { 10 | 11 | command = "echo ${aws_instance.MyfirstEC2instance_Terraform.private_ip} >> private_ip.txt" 12 | } 13 | } 14 | 15 | 16 | resource "aws_eip" "myeip" { 17 | instance = "${aws_instance.MyfirstEC2instance_Terraform.id}" 18 | } 19 | 20 | output "my_eip" { 21 | value = "${aws_eip.myeip.public_ip}" 22 | } 23 | 24 | 25 | resource "null_resource" "ec2-ssh-connection" { 26 | connection { 27 | host = "${aws_eip.myeip.public_ip}" 28 | type = "ssh" 29 | port = 22 30 | user = "ec2-user" 31 | private_key = file("/Users/robinpaul/Downloads/demokey.pem") 32 | timeout = "1m" 33 | agent = false 34 | } 35 | provisioner "file" { 36 | # cp index.html ec2-user@eip:/var/index.html 37 | source = "index.html" 38 | destination = "/home/ec2-user/index.html" 39 | } 40 | provisioner "remote-exec" { 41 | 42 | inline = [ 43 | "sudo yum update -y", 44 | "sudo yum install -y httpd", 45 | "sudo systemctl start httpd.service", 46 | "sudo systemctl enable httpd.service", 47 | "sudo cp /home/ec2-user/index.html /var/www/html/index.html", 48 | ] 49 | } 50 | } 51 | 52 | 53 | # remote_exec -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/sg.tf: -------------------------------------------------------------------------------- 1 | 2 | resource "aws_security_group" "ec2_public_security_group" { 3 | name = "EC2-public-scg" 4 | description = "Internet reaching access for public ec2s" 5 | vpc_id = "${aws_vpc.mainvpc.id}" 6 | 7 | ingress { 8 | from_port = 22 9 | to_port = 22 10 | protocol = "tcp" 11 | cidr_blocks = ["0.0.0.0/0"] 12 | } 13 | ingress { 14 | from_port = 80 15 | to_port = 80 16 | protocol = "tcp" 17 | cidr_blocks = ["0.0.0.0/0"] 18 | } 19 | egress { 20 | from_port = 0 21 | to_port = 0 22 | protocol = "-1" 23 | cidr_blocks = ["0.0.0.0/0"] 24 | } 25 | 26 | tags = { 27 | Name = "ec2_public_security_group" 28 | } 29 | 30 | depends_on = [aws_vpc.mainvpc] 31 | } 32 | 33 | resource "aws_security_group" "ec2_private_security_group" { 34 | name = "EC2-private-scg" 35 | description = "Only allow public SG resources to access private instances" 36 | vpc_id = "${aws_vpc.mainvpc.id}" 37 | 38 | ingress { 39 | from_port = 0 40 | to_port = 0 41 | protocol = "-1" 42 | security_groups = ["${aws_security_group.ec2_public_security_group.id}"] 43 | } 44 | 45 | egress { 46 | from_port = 0 47 | to_port = 0 48 | protocol = "-1" 49 | cidr_blocks = ["0.0.0.0/0"] 50 | } 51 | 52 | tags = { 53 | Name = "ec2_private_security_group" 54 | } 55 | 56 | depends_on = [aws_vpc.mainvpc,aws_security_group.ec2_public_security_group] 57 | } 58 | -------------------------------------------------------------------------------- /amazon-ecs-nodejs-microservices/2-containerized/services/api/server.js: -------------------------------------------------------------------------------- 1 | const app = require('koa')(); 2 | const router = require('koa-router')(); 3 | const db = require('./db.json'); 4 | 5 | // Log requests 6 | app.use(function *(next){ 7 | const start = new Date; 8 | yield next; 9 | const ms = new Date - start; 10 | console.log('%s %s - %s', this.method, this.url, ms); 11 | }); 12 | 13 | router.get('/api/users', function *(next) { 14 | this.body = db.users; 15 | }); 16 | 17 | router.get('/api/users/:userId', function *(next) { 18 | const id = parseInt(this.params.userId); 19 | this.body = db.users.find((user) => user.id == id); 20 | }); 21 | 22 | router.get('/api/threads', function *() { 23 | this.body = db.threads; 24 | }); 25 | 26 | router.get('/api/threads/:threadId', function *() { 27 | const id = parseInt(this.params.threadId); 28 | this.body = db.threads.find((thread) => thread.id == id); 29 | }); 30 | 31 | router.get('/api/posts', function *() { 32 | this.body = db.posts; 33 | }); 34 | 35 | router.get('/api/posts/in-thread/:threadId', function *() { 36 | const id = parseInt(this.params.threadId); 37 | this.body = db.posts.filter((post) => post.thread == id); 38 | }); 39 | 40 | router.get('/api/posts/by-user/:userId', function *() { 41 | const id = parseInt(this.params.userId); 42 | this.body = db.posts.filter((post) => post.user == id); 43 | }); 44 | 45 | router.get('/api/', function *() { 46 | this.body = "API ready to receive requests"; 47 | }); 48 | 49 | router.get('/', function *() { 50 | this.body = "Ready to receive requests"; 51 | }); 52 | 53 | app.use(router.routes()); 54 | app.use(router.allowedMethods()); 55 | 56 | app.listen(3000); 57 | 58 | console.log('Worker started'); 59 | -------------------------------------------------------------------------------- /EKS/terraform/routing-tables.tf: -------------------------------------------------------------------------------- 1 | # Resource: aws_route_table 2 | # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table 3 | 4 | 5 | # a router table contains set of rules , called routes , that are used to determine 6 | # where network traffic from your subnet or gateway is directed 7 | #router table makes the subnet public by routing internet traffice to internet gateway 8 | resource "aws_route_table" "public" { 9 | # The VPC ID. 10 | vpc_id = aws_vpc.main.id 11 | 12 | route { 13 | # The CIDR block of the route. 14 | cidr_block = "0.0.0.0/0" 15 | 16 | # Identifier of a VPC internet gateway or a virtual private gateway. 17 | gateway_id = aws_internet_gateway.main.id 18 | } 19 | 20 | # A map of tags to assign to the resource. 21 | tags = { 22 | Name = "public" 23 | } 24 | depends_on = [ aws_internet_gateway.main ,aws_vpc.main ] 25 | } 26 | 27 | resource "aws_route_table" "private1" { 28 | # The VPC ID. 29 | vpc_id = aws_vpc.main.id 30 | 31 | route { 32 | # The CIDR block of the route. 33 | cidr_block = "0.0.0.0/0" 34 | 35 | # Identifier of a VPC NAT gateway. 36 | nat_gateway_id = aws_nat_gateway.gw1.id 37 | } 38 | 39 | # A map of tags to assign to the resource. 40 | tags = { 41 | Name = "private1" 42 | } 43 | depends_on = [ aws_nat_gateway.gw1 , aws_vpc.main] 44 | } 45 | 46 | resource "aws_route_table" "private2" { 47 | # The VPC ID. 48 | vpc_id = aws_vpc.main.id 49 | 50 | route { 51 | # The CIDR block of the route. 52 | cidr_block = "0.0.0.0/0" 53 | 54 | # Identifier of a VPC NAT gateway. 55 | nat_gateway_id = aws_nat_gateway.gw2.id 56 | } 57 | 58 | # A map of tags to assign to the resource. 59 | tags = { 60 | Name = "private2" 61 | } 62 | 63 | depends_on = [ aws_nat_gateway.gw2, aws_vpc.main ] 64 | } 65 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "PublicEC2" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | ami = "${var.ami}" 4 | instance_type = "${var.instance_type}" 5 | vpc_security_group_ids = ["${aws_security_group.ec2_public_security_group.id}"] 6 | subnet_id = "${aws_subnet.public_subnets[count.index].id}" 7 | key_name = "testkey-us" 8 | tags = { 9 | Name = "${format("PublicEC2-%d", count.index+1)}" 10 | } 11 | user_data = <<-EOF 12 | #!/bin/bash 13 | yum update -y 14 | yum install -y httpd 15 | systemctl start httpd.service 16 | systemctl enable httpd.service 17 | echo "Hi Friend I am public EC2!!!! : $(hostname -f)" > /var/www/html/index.html 18 | EOF 19 | depends_on = [aws_vpc.mainvpc,aws_subnet.public_subnets,aws_security_group.ec2_public_security_group] 20 | } 21 | 22 | resource "aws_instance" "PrivateEC2" { 23 | count = "${length(var.private_subnet_cidr)}" 24 | ami = "${var.ami}" 25 | instance_type = "${var.instance_type}" 26 | vpc_security_group_ids = ["${aws_security_group.ec2_private_security_group.id}"] 27 | 28 | subnet_id = "${aws_subnet.private_subnets[count.index].id}" 29 | key_name = "testkey-us" 30 | tags = { 31 | Name = "${format("PrivateEC2-%d", count.index+1)}" 32 | } 33 | user_data = <<-EOF 34 | #!/bin/bash 35 | yum update -y 36 | yum install -y httpd 37 | systemctl start httpd.service 38 | systemctl enable httpd.service 39 | echo "Hi Friend I am private EC2!!!! : $(hostname -f)" > /var/www/html/index.html 40 | EOF 41 | depends_on = [aws_vpc.mainvpc,aws_subnet.private_subnets,aws_security_group.ec2_private_security_group] 42 | } 43 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "PublicEC2" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | ami = "${var.ami}" 4 | instance_type = "${var.instance_type}" 5 | vpc_security_group_ids = ["${aws_security_group.ec2_public_security_group.id}"] 6 | subnet_id = "${aws_subnet.public_subnets[count.index].id}" 7 | key_name = "testkey-us" 8 | tags = { 9 | Name = "${format("PublicEC2-%d", count.index+1)}" 10 | } 11 | user_data = <<-EOF 12 | #!/bin/bash 13 | yum update -y 14 | yum install -y httpd 15 | systemctl start httpd.service 16 | systemctl enable httpd.service 17 | echo "Hi Friend I am public EC2!!!! : $(hostname -f)" > /var/www/html/index.html 18 | EOF 19 | depends_on = [aws_vpc.mainvpc,aws_subnet.public_subnets,aws_security_group.ec2_public_security_group] 20 | } 21 | 22 | resource "aws_instance" "PrivateEC2" { 23 | count = "${length(var.private_subnet_cidr)}" 24 | ami = "${var.ami}" 25 | instance_type = "${var.instance_type}" 26 | vpc_security_group_ids = ["${aws_security_group.ec2_private_security_group.id}"] 27 | 28 | subnet_id = "${aws_subnet.private_subnets[count.index].id}" 29 | key_name = "testkey-us" 30 | tags = { 31 | Name = "${format("PrivateEC2-%d", count.index+1)}" 32 | } 33 | user_data = <<-EOF 34 | #!/bin/bash 35 | yum update -y 36 | yum install -y httpd 37 | systemctl start httpd.service 38 | systemctl enable httpd.service 39 | echo "Hi Friend I am private EC2!!!! : $(hostname -f)" > /var/www/html/index.html 40 | EOF 41 | depends_on = [aws_vpc.mainvpc,aws_subnet.private_subnets,aws_security_group.ec2_private_security_group] 42 | } 43 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/ec2.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "PublicEC2" { 2 | count = "${length(var.public_subnet_cidr)}" 3 | ami = "${var.ami}" 4 | instance_type = "${var.instance_type}" 5 | vpc_security_group_ids = ["${aws_security_group.ec2_public_security_group.id}"] 6 | subnet_id = "${aws_subnet.public_subnets[count.index].id}" 7 | key_name = "ec2_keypair" 8 | tags = { 9 | Name = "${format("PublicEC2-%d", count.index+1)}" 10 | } 11 | user_data = <<-EOF 12 | #!/bin/bash 13 | yum update -y 14 | yum install -y httpd 15 | systemctl start httpd.service 16 | systemctl enable httpd.service 17 | echo "Hi Friend I am public EC2!!!! : $(hostname -f)" > /var/www/html/index.html 18 | EOF 19 | depends_on = ["aws_vpc.mainvpc","aws_subnet.public_subnets","aws_security_group.ec2_public_security_group"] 20 | } 21 | 22 | resource "aws_instance" "PrivateEC2" { 23 | count = "${length(var.private_subnet_cidr)}" 24 | ami = "${var.ami}" 25 | instance_type = "${var.instance_type}" 26 | vpc_security_group_ids = ["${aws_security_group.ec2_private_security_group.id}"] 27 | 28 | subnet_id = "${aws_subnet.private_subnets[count.index].id}" 29 | key_name = "ec2_keypair" 30 | tags = { 31 | Name = "${format("PrivateEC2-%d", count.index+1)}" 32 | } 33 | user_data = <<-EOF 34 | #!/bin/bash 35 | yum update -y 36 | yum install -y httpd 37 | systemctl start httpd.service 38 | systemctl enable httpd.service 39 | echo "Hi Friend I am private EC2!!!! : $(hostname -f)" > /var/www/html/index.html 40 | EOF 41 | depends_on = ["aws_vpc.mainvpc","aws_subnet.private_subnets","aws_security_group.ec2_private_security_group"] 42 | } 43 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ALB_Part2/alb.tf: -------------------------------------------------------------------------------- 1 | 2 | resource "aws_alb" "webapp_load_balancer" { 3 | load_balancer_type = "application" 4 | name = "Production-WebApp-LoadBalancer" 5 | internal = false 6 | security_groups = ["${aws_security_group.elb_security_group.id}"] 7 | 8 | tags = { 9 | Name = "webapp_load_balancer_TF" 10 | } 11 | subnets = "${aws_subnet.public_subnets.*.id}" 12 | depends_on = [aws_subnet.public_subnets, 13 | aws_security_group.elb_security_group] 14 | } 15 | 16 | 17 | resource "aws_alb_target_group" "alb_front_http" { 18 | name = "alb-front-http" 19 | vpc_id = "${aws_vpc.mainvpc.id}" 20 | port = "80" 21 | protocol = "HTTP" 22 | health_check { 23 | path = "/" 24 | port = "80" 25 | protocol = "HTTP" 26 | healthy_threshold = 5 27 | unhealthy_threshold = 2 28 | interval = 5 29 | timeout = 4 30 | matcher = "200" 31 | } 32 | tags = { 33 | Name = "alb_front_http_TF" 34 | } 35 | depends_on = [aws_vpc.mainvpc] 36 | } 37 | 38 | resource "aws_alb_target_group_attachment" "targetgroup_alb" { 39 | target_group_arn = "${aws_alb_target_group.alb_front_http.arn}" 40 | count = "${length(var.public_subnet_cidr)}" 41 | port = 80 42 | target_id = "${element(aws_instance.PublicEC2.*.id, count.index)}" 43 | } 44 | 45 | resource "aws_alb_listener" "front_end" { 46 | load_balancer_arn = "${aws_alb.webapp_load_balancer.arn}" 47 | port = "80" 48 | protocol = "HTTP" 49 | 50 | default_action { 51 | type = "forward" 52 | target_group_arn = "${aws_alb_target_group.alb_front_http.arn}" 53 | } 54 | 55 | depends_on = [aws_alb.webapp_load_balancer, 56 | aws_alb_target_group.alb_front_http 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /LoadBalance_AutoScaling_Project/12_LB_Project_ASG_Part3/alb.tf: -------------------------------------------------------------------------------- 1 | 2 | resource "aws_alb" "webapp_load_balancer" { 3 | load_balancer_type = "application" 4 | name = "Production-WebApp-LoadBalancer" 5 | internal = false 6 | security_groups = ["${aws_security_group.elb_security_group.id}"] 7 | 8 | tags = { 9 | Name = "webapp_load_balancer_TF" 10 | } 11 | subnets = "${aws_subnet.public_subnets.*.id}" 12 | depends_on = [aws_subnet.public_subnets, 13 | aws_security_group.elb_security_group] 14 | } 15 | 16 | 17 | resource "aws_alb_target_group" "alb_front_http" { 18 | name = "alb-front-http" 19 | vpc_id = "${aws_vpc.mainvpc.id}" 20 | port = "80" 21 | protocol = "HTTP" 22 | health_check { 23 | path = "/" 24 | port = "80" 25 | protocol = "HTTP" 26 | healthy_threshold = 5 27 | unhealthy_threshold = 2 28 | interval = 5 29 | timeout = 4 30 | matcher = "200" 31 | } 32 | tags = { 33 | Name = "alb_front_http_TF" 34 | } 35 | depends_on = [aws_vpc.mainvpc] 36 | } 37 | 38 | resource "aws_alb_target_group_attachment" "targetgroup_alb" { 39 | target_group_arn = "${aws_alb_target_group.alb_front_http.arn}" 40 | count = "${length(var.public_subnet_cidr)}" 41 | port = 80 42 | target_id = "${element(aws_instance.PublicEC2.*.id, count.index)}" 43 | } 44 | 45 | resource "aws_alb_listener" "front_end" { 46 | load_balancer_arn = "${aws_alb.webapp_load_balancer.arn}" 47 | port = "80" 48 | protocol = "HTTP" 49 | 50 | default_action { 51 | type = "forward" 52 | target_group_arn = "${aws_alb_target_group.alb_front_http.arn}" 53 | } 54 | 55 | depends_on = [aws_alb.webapp_load_balancer, 56 | aws_alb_target_group.alb_front_http 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /amazon-ecs-nodejs-microservices/2-containerized/services/api/db.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | { 4 | "id": 1, 5 | "username": "marceline", 6 | "name": "Marceline Abadeer", 7 | "bio": "1000 year old vampire queen, musician" 8 | }, 9 | { 10 | "id": 2, 11 | "username": "finn", 12 | "name": "Finn 'the Human' Mertens", 13 | "bio": "Adventurer and hero, last human, defender of good" 14 | }, 15 | { 16 | "id": 3, 17 | "username": "pb", 18 | "name": "Bonnibel Bubblegum", 19 | "bio": "Scientist, bearer of candy power, ruler of the candy kingdom" 20 | }, 21 | { 22 | "id": 4, 23 | "username": "jake", 24 | "name": "Jake the Dog", 25 | "bio": "Former criminal, now magical dog adventurer, and father" 26 | } 27 | ], 28 | 29 | "threads": [ 30 | { 31 | "id": 1, 32 | "title": "What's up with the Lich?", 33 | "createdBy": 4 34 | }, 35 | { 36 | "id": 2, 37 | "title": "Party at the candy kingdom tomorrow", 38 | "createdBy": 3 39 | }, 40 | { 41 | "id": 3, 42 | "title": "In search of a new guitar", 43 | "createdBy": 1 44 | } 45 | ], 46 | 47 | "posts": [ 48 | { 49 | "thread": 1, 50 | "text": "Has anyone checked on the lich recently?", 51 | "user": 4 52 | }, 53 | { 54 | "thread": 1, 55 | "text": "I'll stop by and see how he's doing tomorrow!", 56 | "user": 2 57 | }, 58 | { 59 | "thread": 2, 60 | "text": "Come party with the candy people tomorrow!", 61 | "user": 3 62 | }, 63 | { 64 | "thread": 2, 65 | "text": "Mathematical!", 66 | "user": 2 67 | }, 68 | { 69 | "thread": 2, 70 | "text": "I'll bring my guitar", 71 | "user": 1 72 | }, 73 | { 74 | "thread": 3, 75 | "text": "I need a new guitar to play the most savory licks in Ooo", 76 | "user": 1 77 | } 78 | ] 79 | } 80 | -------------------------------------------------------------------------------- /ECS/ecs.tf: -------------------------------------------------------------------------------- 1 | # ecs.tf 2 | 3 | resource "aws_ecs_cluster" "main" { 4 | name = "lab-cluster" 5 | tags = { 6 | Name = "ecs_demo_terraform_course" 7 | } 8 | } 9 | 10 | resource "aws_ecs_task_definition" "app" { 11 | family = "web-app-task" 12 | execution_role_arn = aws_iam_role.ecs_task_execution_role.arn 13 | network_mode = "awsvpc" 14 | requires_compatibilities = ["FARGATE"] 15 | cpu = var.fargate_cpu 16 | memory = var.fargate_memory 17 | container_definitions = < 14 | 15 | 16 | 17 | aws ecr --region us-east-1 | docker login -u AWS -p eyJwYXlsb2FkIjoiNEtEM3pma1cxa0drWW1wUGtibnVtd0gyYXFCbFhMOXpkemticDlqN1hnYktGODFiS0FBUGhGaU4vNUtYWVdXSi81YWNSUkU1YzhmamtNMVlhZ1lrbVdvSXdPbEJtcGFnUlpoRGZvc3Uya01ZNEVGdHh6aG1JOXZ1bm91UTlGbFo1TUlnUEVhZUlmWW5KTWQzaDVCK09ybFVZVE5wUTg5cEtrTjFLQ3RrK3MzWUR1TlVHSTY2MGpOWk0vdEV0SmVUV2pSYXRWN28wTng3d2JPM3BMZ1NRb0tndUVzMjQwd0grSGdWNVQzVWQ3bjNXMzF2RWF6akU5YmlvbVhTYXFNOGZPWC9tR0NrYmpPRHlCQzNoWnB6Y2I5NGtQTU5wMW5wV3lNeDBIclprUTRTK0h2RnV1ZDZleFNuRlgyRFprYTBDclZ4clYyZys3eGMxQkcybnlGVkpJT29jbHlsQmJPZEsrNW44dnRxQ3RBOE5CczdJWGtISlI0K3hqYnJrZTRxZ25mbG04b3RNZVZwRkxWWFhLMHpRVi9CR1AydG5GS01DbEE4RFN3bDlKVWxuU25kRWd5Z1lNNUVIOGw0NFk2TUZwWG9SM2FzKy9JV21pa3Q1NGVDSEhHTGZjTmVyNm1yaXdMS0ptK3M0MUs0MHpLNG9mb1JEZWgxcFh2Z3ZSTXJ4TXArcEt3NlpweXJoQnEvd1lyTlZkcU1Hb1F3NU5nY3dGTWltQXJ3dVRKcVdnc0xuM1VvbnpsbGxmVXNWdnRvSC95OVpaTG1FUVpURXFoTit6eUU3UGtzRDlwOE1oM3M1cC9nam5VaVFmKzE1SWFXL3dhd01lVnIrTU42QTlhZ0dSZXNibmpxaStjR2R2cnBMZ21ySGdOeklTT3dMY0tSNkZQUk1xYTl0ZnIycGdzWVd0Nmd4a0o2RlBFSWJYTUVDVEo1UHNtbldlK1JrR3RhU0dOa1kvS2p2N1lnRUtTUVhLNUpqQUlnQVcxQTh1d3V2NGVYeGY1bzF4bFptejU3YnJHZXpCZi9WM0U3SHd5VXJIdFJhN1h4SWpGQkdyNkc5STdDdVFPTU5VSGtScjQ3NTEzUmIyUmlibGtlVjM3dVRvNVIyZ3l6TEJBUHZKdjNKblI0bm05NGt2MnVjUjVTWWNyLzFRTzlqZHAvaXpFMEU2THU4RUtDZXBET3E5dWtaclNVazVRRXQ1cDdKWkRLYjQ5bXIrUjB1OFBtcGFueVI5SURJU0hjZU95OEZBbWtCSTNqWk5yUDAzN3JwTFVTWnpPL2VzQ29hNkxhTjNPNXZ0b1hxM3VDOE9BR0loR2FyK1V0M2RBZ0tjdEcvV2hGT1Rwd1NJMjhlQm5McWhXTk9IdzU3dXpRc2ZVYmI2ZEdaQT09IiwiZGF0YWtleSI6IkFRRUJBSGh3bTBZYUlTSmVSdEptNW4xRzZ1cWVla1h1b1hYUGU1VUZjZTlScTgvMTR3QUFBSDR3ZkFZSktvWklodmNOQVFjR29HOHdiUUlCQURCb0Jna3Foa2lHOXcwQkJ3RXdIZ1lKWUlaSUFXVURCQUV1TUJFRURQcEhPVm40Mlk3TEM1S0QvZ0lCRUlBN3k4cDN6ek4xLzYxUkpwRmlaWkhHR0I3YjZzdi81Zksvd0I2TDhtQ2k2RXlqUC95RDFTMFhoSDBPdGFrbmc0K1JaVlFERzVWNW83bVQ4MDA9IiwidmVyc2lvbiI6IjIiLCJ0eXBlIjoiREFUQV9LRVkiLCJleHBpcmF0aW9uIjoxNjk1NjgzMzA2fQ== 439398671644.dkr.ecr.us-east-1.amazonaws.com/awslab 18 | 19 | #push docker image to aws ecr 20 | docker push 439398671644.dkr.ecr.us-east-1.amazonaws.com/ecr-repo-for-tf-lab:v1 -------------------------------------------------------------------------------- /DeepDive-TerraformFeatures/6_provisioners/.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.17.0" 6 | hashes = [ 7 | "h1:rplvK7UGP2FuzM44t2eRX+QYYPC0aUIoKdi5XayRI8M=", 8 | "zh:0087b9dd2c9c638fd63e527e5b9b70988008e263d480a199f180efe5a4f070f0", 9 | "zh:0fd532a4fd03ddef11f0502ff9fe4343443e1ae805cb088825a71d6d48906ec7", 10 | "zh:16411e731100cd15f7e165f53c23be784b2c86c2fcfd34781e0642d17090d342", 11 | "zh:251d520927e77f091e2ec6302e921d839a2430ac541c6a461aed7c08fb5eae12", 12 | "zh:4919e69682dc2a8c32d44f6ebc038a52c9f40af9c61cb574b64e322800d6a794", 13 | "zh:5334c60759d5f76bdc51355d1a3ebcc451d4d20f632f5c73b6e55c52b5dc9e52", 14 | "zh:7341a2b7247572eba0d0486094a870b872967702ec0ac7af728c2df2c30af4e5", 15 | "zh:81d1b1cb2cac6b3922a05adab69543b678f344a01debd54500263700dad7a288", 16 | "zh:882bc8e15ef6d4020a07321ec4c056977c5c1d96934118032922561d29504d43", 17 | "zh:8cd4871ef2b03fd916de1a6dc7eb8a81a354c421177d4334a2e3308e50215e41", 18 | "zh:97e12fe6529b21298adf1046c5e20ac35d0569c836a6f385ff041e257e00cfd2", 19 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 20 | "zh:9f5baf5d59b9f3cf5504d1fa975f10f27da3791896a9e18ece47c258bac17634", 21 | "zh:dffafba6731ac1db1c540bdbd6a8c878486b71de9d0ca1d23c5c00a6c3c14d80", 22 | "zh:fa7440c3c15a42fc5731444d324ced75407d417bfe3184661ae47d40a9718dce", 23 | ] 24 | } 25 | 26 | provider "registry.terraform.io/hashicorp/null" { 27 | version = "3.2.1" 28 | hashes = [ 29 | "h1:ydA0/SNRVB1o95btfshvYsmxA+jZFRZcvKzZSB+4S1M=", 30 | "zh:58ed64389620cc7b82f01332e27723856422820cfd302e304b5f6c3436fb9840", 31 | "zh:62a5cc82c3b2ddef7ef3a6f2fedb7b9b3deff4ab7b414938b08e51d6e8be87cb", 32 | "zh:63cff4de03af983175a7e37e52d4bd89d990be256b16b5c7f919aff5ad485aa5", 33 | "zh:74cb22c6700e48486b7cabefa10b33b801dfcab56f1a6ac9b6624531f3d36ea3", 34 | "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", 35 | "zh:79e553aff77f1cfa9012a2218b8238dd672ea5e1b2924775ac9ac24d2a75c238", 36 | "zh:a1e06ddda0b5ac48f7e7c7d59e1ab5a4073bbcf876c73c0299e4610ed53859dc", 37 | "zh:c37a97090f1a82222925d45d84483b2aa702ef7ab66532af6cbcfb567818b970", 38 | "zh:e4453fbebf90c53ca3323a92e7ca0f9961427d2f0ce0d2b65523cc04d5d999c2", 39 | "zh:e80a746921946d8b6761e77305b752ad188da60688cfd2059322875d363be5f5", 40 | "zh:fbdb892d9822ed0e4cb60f2fedbdbb556e4da0d88d3b942ae963ed6ff091e48f", 41 | "zh:fca01a623d90d0cad0843102f9b8b9fe0d3ff8244593bd817f126582b52dd694", 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /Lambda_APIGateway_CloudWatch_Serverless/13_lambda_apigateway_lab_2/lambda.tf: -------------------------------------------------------------------------------- 1 | resource "aws_lambda_function" "lambda_tf" { 2 | filename = "lambda.zip" 3 | function_name = "lambda_handler" 4 | role = "${aws_iam_role.iam_for_lambda.arn}" 5 | #filename = lambda 6 | #function_name = lambda_handler 7 | handler = "lambda.lambda_handler" 8 | runtime = "python3.9" 9 | 10 | 11 | # The filebase64sha256() function is available in Terraform 0.11.12 and later 12 | # For Terraform 0.11.11 and earlier, use the base64sha256() function and the file() function: 13 | # source_code_hash = "${base64sha256(file("lambda.zip"))}" 14 | source_code_hash = "${filebase64sha256("lambda.zip")}" 15 | depends_on = [aws_iam_role.iam_for_lambda] 16 | } 17 | 18 | 19 | resource "aws_iam_role" "iam_for_lambda" { 20 | name = "iam_for_lambda" 21 | 22 | assume_role_policy = <