[
  {
    "path": ".github/workflows/terraform.yml",
    "content": "name: terraform-tutorials-ci\n\non: [push, pull_request]\n\nenv:\n  AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }}\n  AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}\n  ACTIONS_ALLOW_UNSECURE_COMMANDS: true  \n\njobs:\n  build:\n    name: build\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v1\n      - name: Set up Terraform\n        uses: marocchino/setup-terraform@v1\n        with:\n          version: \"0.12.15\"\n      - name: Build module 'aws-instance-first-script'\n        run: cd aws-instance-first-script && terraform init && terraform validate && terraform plan \n      - name: Build module 'aws-EC2-with-jenkins'\n        run: cd EC2withJenkins && terraform init && terraform validate && terraform plan\n      - name: Build module 'aws-Application-Load-Balancer'\n        run: cd terraform-aws-elb-alb && terraform init && terraform validate && terraform plan\n"
  },
  {
    "path": ".gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "EC2withJenkins/README.md",
    "content": "# Terraform-Tutorial # Jenkins Install in EC2 Instance\n\n\nTerraform Tutorial is the set of examples of [Terraform](https://www.terraform.io/) modules that is building the EC2 Instance with jenkins\ninfrastructure resources on AWS Cloud.\n\nTo learn about module, follow the readme of each module.\n\n## Developing\n\n- **Terraform**: v0.11.14\n- **Terraform Docs**: https://www.terraform.io/docs/configuration-0-11/index.html\n\n## Usage\n\n```hcl\nmodule \"ec2_instance\" {\n  source     = \"git::https://github.com/easyawslearn/Terraform-Tutorial.git/EC2withJenkins\"\n\n  region        = \"us-west-2\"\n  key-name      = \"ec2-demo\"\n  instance_type = \"t2.micro\"\n\n}\n```\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-----:|:-----:|\n| region | AWS region | string | us-east-1 | yes |\n| key-name | ec2 access key name | string | ec2-demo | yes |\n| instance_type | ec2 instance_type | string | t2.micro | yes |\n"
  },
  {
    "path": "EC2withJenkins/ec2_jenkins.tf",
    "content": "\r\nresource \"aws_instance\" \"ec2_jenkins\" {\r\n  ami           = \"${lookup(var.ami_id, var.region)}\"\r\n  instance_type = \"${var.instance_type}\"\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n\r\n  # key name\r\n  key_name = \"${var.key_name}\"\r\n\r\n  user_data = <<EOF\r\n\t\t#! /bin/bash\r\n                sudo yum update -y\r\n\t\tsudo yum install -y httpd.x86_64\r\n\t\tsudo service httpd start\r\n\t\tsudo service httpd enable\r\n\t\techo \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n\r\n    yum install java-1.8.0-openjdk-devel -y\r\n    curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo\r\n    sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key\r\n    yum install -y jenkins\r\n    systemctl start jenkins\r\n    systemctl status jenkins\r\n    systemctl enable jenkins\r\n\r\n\t   EOF\r\n\r\n  tags = {\r\n    Name = \"Ec2-User-data\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "EC2withJenkins/provider.tf",
    "content": "provider \"aws\" {\r\n  region  = \"${var.region}\"\r\n  version = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "EC2withJenkins/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  #vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n  ingress {\r\n    # SSH Port 80 allowed from any IP\r\n    from_port   = 80\r\n    to_port     = 80\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n  ingress {\r\n    # SSH Port 80 allowed from any IP\r\n    from_port   = 8080\r\n    to_port     = 8080\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "EC2withJenkins/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-00dc79254d0461090\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n"
  },
  {
    "path": "README.md",
    "content": "# Terraform-Tutorial\n\n![](https://github.com/easyawslearn/Terraform-Tutorial/workflows/terraform-tutorials-ci/badge.svg)\n\nTerraform Tutorial is the set of examples of [Terraform](https://www.terraform.io/) modules that is building the infrastructure resources \non AWS Cloud.\n\nTo learn about module, follow the readme of each module.\n\n## Developing\n\n- **Terraform**: v0.11.14\n- **Terraform Docs**: https://www.terraform.io/docs/configuration-0-11/index.html\n- **Youtube Channel for subscription**: https://www.youtube.com/channel/UCck6BsJ0H8C8C8JVgSS1b8Q?view_as=subscriber\n- **Terraform Tutorial in English**: https://www.youtube.com/watch?v=5WykrpB7qS4&list=PL_OdF9Z6GmVaRD6e6sYLQO_WYqTKcj3aj\n- **Terraform Tutorial in Hindi**: https://www.youtube.com/watch?v=LNYQXLf60N4&list=PL_OdF9Z6GmVY9QfBfNUua_X2c2mT65SAX\n"
  },
  {
    "path": "Software-provision/.gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "Software-provision/README.md",
    "content": "# Terraform-Tutorial\nTerraform Tutorial with all the Live Example\n"
  },
  {
    "path": "Software-provision/aws-instance-server-configure.tf",
    "content": "\r\nresource \"aws_instance\" \"web-server\" {\r\n  ami           = \"${lookup(var.ami_id, var.region)}\"\r\n  instance_type = \"t2.micro\"\r\n  key_name      = \"terraform\"\r\n\r\n\r\n  provisioner \"file\" {\r\n    source      = \"index.html\"\r\n    destination = \"/tmp/index.html\"\r\n  }\r\n  provisioner \"remote-exec\" {\r\n      inline = [\r\n        \"sudo yum install -y httpd;sudo cp /tmp/index.html /var/www/html/\",\r\n        \"sudo service httpd restart\",\r\n        \"sudo service httpd status\"\r\n      ]\r\n    }\r\n  connection {\r\n    user        = \"ec2-user\"\r\n    private_key = \"${file(\"${var.private_key_path}\")}\"\r\n      host = \"${aws_instance.web-server.public_ip}\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "Software-provision/index.html",
    "content": "<HTML>\r\n<HEAD>\r\nTHIS IS MY WEB Server Deployed on AWS EC2 Intance using Terraform Script\r\n</HEAD>\r\n</HTML>\r\n"
  },
  {
    "path": "Software-provision/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "Software-provision/terraform.pem",
    "content": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIEpAIBAAKCAQEAjwPLx8LUEWbq9K84qM7J39Ksl8gtAtKczKuduC6xfEygjfznhjG73wp1qAKG\r\npfKJJS20r/mShYbWsnKRojjM+tU0Jm76gTzpOwXYG3eWA4bsoAOdZtWyKPnl1scb/SP5X5Fdvtka\r\nbaeVbz+lekX7c540wTGWzf4AuZjTs29A/PUYWKW9sOwsth4WgSHDuNdQznU0EgXhzuV7a9z4FlrR\r\n+SZ400g6ONs2hfT7o4sqSGu8JcVnJUyQY0lY1Sgnkw0g0KGdyP2ZA6dIHcNutcYnRXNmspIRfdG9\r\n79BDKeYNsdU/U0hk1YLAe8j7vH0Iq3oMCU5FdRUr5ITSD4Xt5M9zAQIDAQABAoIBAHwJ1c+PKjFh\r\nqvzHkIPQvoRzC6ClTGy7UKWvXx7k2KkvKL2dkQzxy7k6MCuk7TW28r4dMy7BbhSDi2jAN5GUZCxV\r\niGKhNIGs27iGbBX+lUy/1DFAkV8kjt49R9wNWzgl4F7EDKO/Vs2uYMxZTmOLmPiBSc4Z/WryF5zh\r\ncROatanudwmNKH/Mg+Wj9TuOFS5b5Lir0H0xfip+SHRbjWQAd8xp3RqYl82HzHbrJKbkVNiLqrd2\r\n7IIkbfd6wMKtacruROLofNgDUSHr7050aIh/dgQIOXK08qAdlGRceQ/wUJsQVZqCta4alnu7lQTi\r\n4lATrnincZM8RZL9dBayMIKXGLECgYEA2hvv6mtZIQYmZeC1Z/anpcE0PQUunuvahKliTbRa4yKw\r\n6EHC/I8fZPNSFhqHnCml88k6ptaTDH13zqFF7CrcD2JqhRTjHkFZGP3u6sP63BJ2QJFOVglwvk9Y\r\n7fr2BHKNIOdyHOpZccHOaIxXN6EY3CUyH+5RBmOY1HfDuM1Trc0CgYEAp9woN4NKL0e25PxEhgnD\r\nvlNRHEPT5ltHTSqiQUjK63OP36A8WF/cGhJUXtXuAXVWcFIfMRh9g+XsYaFtvCDYykPsRYlZJQYV\r\nKRncAVk29qyfJe11zvOD99uo+wro/V+dXRQkbgtFrcOYF3eBmAuVCWi+Eyp5pm/cgZbY/JRDRgUC\r\ngYEAlbwYORb5WXKfadGauITdEy5QbpPgLbo9ilW+5xmqS8TFLq327uxS4TsqX4JXFx6Aj5zWZzNo\r\nQGrilTiiiD/kU6t89WAhi+PRBxdNrl5dGjiSdkFLRkW04PIYW0ivHN6HhM9fx/oa7b3ftmaiec5f\r\nAsOGZeV2Oqylfze5ZmWPzQECgYEAjG5XBvpDmgJ5NGEIQsrwg83YUbk9Eb7Ti+9bBxsLCKgJeaDo\r\nW1b3IKitBRocoAO2aQmLJtvCRhKZC6St1XH1bGIezJ33gk3wbg5ATLCClyQbkPN0V8rKYRXX7Q5X\r\nlYHkePZc8+NiS9kS6K8GMFmgOdrzCb3DQEbdR10X81dmYLECgYAhsgAbZNzrXAO+E3ooTJgIyZLW\r\nQxB74kDIxTNFgUL+U01l70x92aY03TofLFare+9jGuNdDmLjzqbTswz/AXK8FUkxbRo8R18ldpoz\r\ngvgh56v8VYulsULRphNeKoXJG3CTRmQEjDgrKYRSzHed3nVnRctT0iUAg/zAbUpzOIhdgg==\r\n-----END RSA PRIVATE KEY-----"
  },
  {
    "path": "Software-provision/variables.tf",
    "content": "variable \"access_key\" {}\r\nvariable \"secret_key\" {}\r\nvariable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"private_key_path\" {\r\n  default = \"terraform.pem\"\r\n}\r\n\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "Terraform-aws-route53/instance.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\n\r\nresource \"aws_instance\" \"IP_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n  private_ip = \"10.0.1.10\"\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n    #! /bin/bash\r\n                sudo yum update -y\r\n    sudo yum install -y httpd.x86_64\r\n    sudo service httpd start\r\n    sudo service httpd enable\r\n    echo \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n  EOF\r\n\r\n  tags = {\r\n    Name = \"Private_IP\"\r\n  }\r\n}\r\n\r\nresource \"aws_eip\" \"eip\" {\r\n  instance = aws_instance.IP_example.id\r\n  vpc      = true\r\n}\r\n\r\noutput \"public_ip\" {\r\n  value = aws_instance.IP_example.public_ip\r\n}\r\n"
  },
  {
    "path": "Terraform-aws-route53/route53.tf",
    "content": "resource \"aws_route53_zone\" \"easy_aws\" {\r\n  name = \"easyaws.in\"\r\n\r\n  tags = {\r\n    Environment = \"dev\"\r\n  }\r\n}\r\n\r\nresource \"aws_route53_record\" \"www\" {\r\n  zone_id = aws_route53_zone.easy_aws.zone_id\r\n  name    = \"www.easyaws.in\"\r\n  type    = \"A\"\r\n  ttl     = \"300\"\r\n  records = [aws_eip.eip.public_ip]\r\n}\r\n\r\noutput \"name_server\"{\r\n  value=aws_route53_zone.easy_aws.name_servers\r\n}\r\n"
  },
  {
    "path": "Terraform-aws-route53/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"device_name\" {\r\n  type    = \"string\"\r\n  default = \"/dev/xvdh\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "Terraform-aws-route53/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block           = var.cidr\r\n  instance_tenancy     = var.instance_tenancy\r\n  enable_dns_hostnames = var.enable_dns_hostnames\r\n  enable_dns_support   = var.enable_dns_support\r\n  enable_classiclink   = var.enable_classiclink\r\n\r\n  tags = {\r\n    Name = var.tags\r\n  }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone       = \"us-east-1a\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n\r\nresource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 80 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "aws-instance-example.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_instance\" \"my_web_server\" {\r\n  ami           = \"${lookup(var.ami_id, var.region)}\"\r\n  instance_type = \"t2.micro\"\r\n}\r\n"
  },
  {
    "path": "aws-instance-first-script/.gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "aws-instance-first-script/Jenkinsfile",
    "content": "\r\npipeline {\r\n\r\n    parameters {\r\n        string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment')\r\n        booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?')\r\n\r\n    }\r\n\r\n\r\n     environment {\r\n        AWS_ACCESS_KEY_ID     = credentials('AWS_ACCESS_KEY_ID')\r\n        AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY')\r\n    }\r\n\r\n   agent  any\r\n        options {\r\n                timestamps ()\r\n                ansiColor('xterm')\r\n            }\r\n    stages {\r\n        stage('checkout') {\r\n            steps {\r\n                 script{\r\n                        dir(\"terraform\")\r\n                        {\r\n                            git \"https://github.com/easyawslearn/Terraform-Tutorial.git\"\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n        stage('Plan') {\r\n            steps {\r\n                sh 'pwd;cd terraform/aws-instance-first-script ; terraform init -input=false'\r\n                sh 'pwd;cd terraform/aws-instance-first-script ; terraform workspace new ${environment}'\r\n                sh 'pwd;cd terraform/aws-instance-first-script ; terraform workspace select ${environment}'\r\n                sh \"pwd;cd terraform/aws-instance-first-script ;terraform plan -input=false -out tfplan \"\r\n                sh 'pwd;cd terraform/aws-instance-first-script ;terraform show -no-color tfplan > tfplan.txt'\r\n            }\r\n        }\r\n        stage('Approval') {\r\n           when {\r\n               not {\r\n                   equals expected: true, actual: params.autoApprove\r\n               }\r\n           }\r\n\r\n           steps {\r\n               script {\r\n                    def plan = readFile 'terraform/aws-instance-first-script/tfplan.txt'\r\n                    input message: \"Do you want to apply the plan?\",\r\n                    parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)]\r\n               }\r\n           }\r\n       }\r\n\r\n        stage('Apply') {\r\n            steps {\r\n                sh \"pwd;cd terraform/aws-instance-first-script ; terraform apply -input=false tfplan\"\r\n            }\r\n        }\r\n    }\r\n\r\n  }\r\n"
  },
  {
    "path": "aws-instance-first-script/README.md",
    "content": "# aws-instance-first-script\n\n![](https://github.com/easyawslearn/Terraform-Tutorial/workflows/terraform-tutorials-ci/badge.svg)\n\nA Terraform module for creating AWS EC2 instance.\n\n## Usage\n\n```hcl\nmodule \"ec2_instance\" {\n  source     = \"git::https://github.com/easyawslearn/Terraform-Tutorial.git//aws-instance-first-script\"\n\n  region    = \"us-west-2\"\n}\n```\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-----:|:-----:|\n| region | AWS region | string | us-east-1 | yes |\n"
  },
  {
    "path": "aws-instance-first-script/aws-instance-example.tf",
    "content": "resource \"aws_instance\" \"web1\" {\r\n   ami           = \"${lookup(var.ami_id, var.region)}\"\r\n   instance_type = \"t2.micro\"\r\n }\r\n"
  },
  {
    "path": "aws-instance-first-script/provider.tf",
    "content": "provider \"aws\" {\n  region  = \"${var.region}\"\n  version = \"~> 2.0\"\n}\n"
  },
  {
    "path": "aws-instance-first-script/variables.tf",
    "content": "variable \"region\" {\n  default = \"us-east-1\"\n}\n\nvariable \"ami_id\" {\n  type = \"map\"\n\n  default = {\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\n    eu-central-1 = \"ami-9787h5h6nsn\"\n  }\n}\n"
  },
  {
    "path": "ebs-with-userdata/README.md",
    "content": "# aws-instance-with-ebs-volume\n\nA Terraform module for creating AWS EC2 instance with userdata for creating EBS.\n\n## Usage\n\n```hcl\nmodule \"ec2_instance\" {\n  source     = \"git::https://github.com/easyawslearn/Terraform-Tutorial.git/ebc-with-userdata\"\n\n  region    = \"us-west-2\"\n  key-name  = \"ec2-demo\"\n  instance_type = \"t2.micro\"\n  ebs_size = \"20\"\n}\n```\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-----:|:-----:|\n| region | AWS region | string | us-east-1 | yes |\n| key-name | ec2 access key name | string | ec2-demo | yes |\n| instance_type | ec2 instance_type | string | t2.micro | yes |\n| ebs_size | EBS volume size | string | 20 | yes |\n"
  },
  {
    "path": "ebs-with-userdata/ebs_volume.tf",
    "content": "resource \"aws_ebs_volume\" \"ebs_volume\" {\r\n  availability_zone = \"us-east-1a\"\r\n  size              = var.ebs_size\r\n  type              = \"gp2\"\r\n\r\n  tags = {\r\n    Name = \"ebs-volume-terraform-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_volume_attachment\" \"ebc_volume_attachment\" {\r\n  device_name = var.device_name\r\n  volume_id   = aws_ebs_volume.ebs_volume.id\r\n  instance_id = aws_instance.ebs_instance_example.id\r\n}\r\n\r\ndata \"template_file\" \"init\" {\r\n  template = \"${file(\"volume.sh\")}\"\r\n\r\n  vars = {\r\n    device_name = var.device_name\r\n  }\r\n}\r\n"
  },
  {
    "path": "ebs-with-userdata/instance.tf",
    "content": "provider \"aws\" {\r\n  region     = var.region\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_instance\" \"ebs_instance_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n  # User data passing through template rendering\r\n  user_data = data.template_file.init.rendered\r\n\r\n  tags = {\r\n    Name = \"EBS with userdata\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "ebs-with-userdata/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 80 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "ebs-with-userdata/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"device_name\" {\r\n  type    = \"string\"\r\n  default = \"/dev/xvdh\"\r\n}\r\n\r\nvariable \"ebs_size\" {\r\n  type    = \"string\"\r\n  default = \"20\"\r\n}\r\n\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "ebs-with-userdata/volume.sh",
    "content": "#!/bin/bash -xe\r\nexec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1\r\nsleep 30\r\nsudo mkdir -p  /data\r\nsleep 30\r\nsudo mkfs.ext4 ${device_name}\r\nsudo mount ${device_name} /data\r\n"
  },
  {
    "path": "ebs-with-userdata/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block           = var.cidr\r\n  instance_tenancy     = var.instance_tenancy\r\n  enable_dns_hostnames = var.enable_dns_hostnames\r\n  enable_dns_support   = var.enable_dns_support\r\n  enable_classiclink   = var.enable_classiclink\r\n\r\n  tags = {\r\n    Name = var.tags\r\n  }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone       = \"us-east-1a\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n"
  },
  {
    "path": "kms_policy.json.tpl",
    "content": "{\n  \"Version\": \"2012-10-17\",\n  \"Id\": \"kms-key-policy\",\n  \"Statement\": [\n    {\n      \"Sid\": \"Enable IAM User Permissions\",\n      \"Effect\": \"Allow\",\n      \"Principal\": {\"AWS\": \"arn:aws:iam::${account_id}:root\",\"Service\": \"logs.us-east-1.amazonaws.com\"},\n      \"Action\": \"kms:*\",\n      \"Resource\": \"*\"\n    }\n  ]\n}\n"
  },
  {
    "path": "main.tf",
    "content": "data \"template_file\" \"kms_policy\" {\n  template = \"${file(\"${kms_policy.json.tpl\")}\"\n\n  vars {\n    account_id = \"${var.account_id}\"\n  }\n}\n\nresource \"aws_kms_key\" \"key\" {\n  policy = \"${data.template_file.kms_policy.rendered}\"\n}\n\nresource \"aws_cloudwatch_log_group\" \"yada\" {\n  name = \"vijay\"\n\n  kms_key_id = aws_kms_key.key.arn\n\n}\n"
  },
  {
    "path": "provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-autoscaling/main.tf",
    "content": "provider \"aws\" {\r\n  region     = var.region\r\n}\r\n\r\nresource \"aws_launch_configuration\" \"launch_config\" {\r\n  name          = \"web_config\"\r\n  image_id      = lookup(var.ami_id, var.region)\r\n  instance_type = \"t2.micro\"\r\n  key_name      = var.key_name\r\n  security_groups = [ var.security_grpup_id]\r\n}\r\n\r\nresource \"aws_autoscaling_group\" \"example_autoscaling\" {\r\n  name                      = \"autoscaling-terraform-test\"\r\n  max_size                  = 2\r\n  min_size                  = 1\r\n  health_check_grace_period = 300\r\n  health_check_type         = \"EC2\"\r\n  desired_capacity          = 1\r\n  force_delete              = true\r\n  launch_configuration      = aws_launch_configuration.launch_config.name\r\n  availability_zones        = [\"us-east-1a\",\"us-east-1b\"]\r\n  # vpc_zone_identifier       = [aws_subnet.example1.id, aws_subnet.example2.id]\r\n\r\n}\r\n\r\nresource \"aws_autoscaling_policy\" \"asp\" {\r\n  name                   = \"asp-terraform-test\"\r\n  scaling_adjustment     = 1\r\n  adjustment_type        = \"ChangeInCapacity\"\r\n  cooldown               = 300\r\n  policy_type            = \"SimpleScaling\"\r\n  autoscaling_group_name = aws_autoscaling_group.example_autoscaling.name\r\n}\r\n\r\nresource \"aws_cloudwatch_metric_alarm\" \"aws_cloudwatch_metric_alarm\" {\r\n  alarm_name                = \"terraform-test-cloudwatch\"\r\n  comparison_operator       = \"GreaterThanOrEqualToThreshold\"\r\n  evaluation_periods        = \"2\"\r\n  metric_name               = \"CPUUtilization\"\r\n  namespace                 = \"AWS/EC2\"\r\n  period                    = \"120\"\r\n  statistic                 = \"Average\"\r\n  threshold                 = \"30\"\r\n  alarm_description         = \"This metric monitors ec2 cpu utilization\"\r\n  \r\n   dimensions = {\r\n    AutoScalingGroupName = aws_autoscaling_group.example_autoscaling.name\r\n  }\r\n  \r\n    actions_enabled     = true\r\n    alarm_actions     = [aws_autoscaling_policy.asp.arn]\r\n\r\n}\r\n\r\nresource \"aws_sns_topic\" \"user_updates\" {\r\n  name = \"user-updates-topic\"\r\n  display_name = \"example auto scaling\"\r\n}\r\n\r\nresource \"aws_autoscaling_notification\" \"example_notifications\" {\r\n  group_names = [aws_autoscaling_group.example_autoscaling.name]\r\n\r\n  notifications = [\r\n    \"autoscaling:EC2_INSTANCE_LAUNCH\",\r\n    \"autoscaling:EC2_INSTANCE_TERMINATE\",\r\n    \"autoscaling:EC2_INSTANCE_LAUNCH_ERROR\",\r\n    \"autoscaling:EC2_INSTANCE_TERMINATE_ERROR\",\r\n  ]\r\n\r\n  topic_arn = aws_sns_topic.user_updates.arn\r\n}"
  },
  {
    "path": "terraform-aws-autoscaling/variables.tf",
    "content": "variable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\n\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-04d29b6f966df1537\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\n\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"subnets\" {\r\n  type    = list(string)\r\n  default = [\"subnet-59b98303\",\"subnet-0d7cb232\"]\r\n}\r\n\r\nvariable \"azs\" {\r\n  type    = list(string)\r\n  default = [\"us-east-1a\",\"us-east-1b\"]\r\n}\r\n\r\nvariable \"security_grpup_id\" {\r\n  type    = \"string\"\r\n  default = \"sg-53623a20\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ebs/ebs_volume.tf",
    "content": "resource \"aws_ebs_volume\" \"ebs_volume\" {\r\n  availability_zone = \"us-east-1a\"\r\n  size              = 20\r\n  type              = \"gp2\"\r\n\r\n  tags = {\r\n    Name = \"ebs-volume-terraform-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_volume_attachment\" \"ebc_volume_attachment\" {\r\n  device_name = \"/dev/xvdh\"\r\n  volume_id   = aws_ebs_volume.ebs_volume.id\r\n  instance_id = aws_instance.ebs_instance_example.id\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ebs/instance.tf",
    "content": "provider \"aws\" {\r\n  region = var.region\r\n}\r\n\r\nresource \"aws_instance\" \"ebs_instance_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  tags = {\r\n    Name = \"Ec2-with-VPC\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ebs/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ebs/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ebs/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block           = var.cidr\r\n  instance_tenancy     = var.instance_tenancy\r\n  enable_dns_hostnames = var.enable_dns_hostnames\r\n  enable_dns_support   = var.enable_dns_support\r\n  enable_classiclink   = var.enable_classiclink\r\n\r\n  tags = {\r\n    Name = var.tags\r\n  }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone       = \"us-east-1a\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/apache_config.sh",
    "content": "#! /bin/bash\r\nsudo yum update -y\r\nsudo yum install -y httpd.x86_64\r\nsudo service httpd start\r\nsudo service httpd enable\r\necho \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/output.tf",
    "content": "output \"public_ip\" {\r\n  value = \"${aws_instance.user_data_example.public_ip}\"\r\n}\r\noutput \"user_data_example_input_file\" {\r\n  value = \"${aws_instance.user_data_example_input_file.public_ip}\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  #vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 80 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/user-data-file-input.tf",
    "content": "\r\nresource \"aws_instance\" \"user_data_example_input_file\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n#  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n  user_data = \"${file(\"apache_config.sh\")}\"\r\n\r\n  tags = {\r\n    Name = \"Ec2-User-data-with-file\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/user_data.tf",
    "content": "\r\nresource \"aws_instance\" \"user_data_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n#  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n\t\t#! /bin/bash\r\n                sudo yum update -y\r\n\t\tsudo yum install -y httpd.x86_64\r\n\t\tsudo service httpd start\r\n\t\tsudo service httpd enable\r\n\t\techo \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n\tEOF\r\n\r\n  tags = {\r\n    Name = \"Ec2-User-data\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-userdata/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-with-vpc/instance.tf",
    "content": "resource \"aws_instance\" \"web\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n\r\n# Public Subnet assign to instance\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n# Security group assign to instance\r\n  vpc_security_group_ids=[aws_security_group.allow_ssh.id]\r\n\r\n# key name\r\nkey_name = var.key_name\r\n\r\n  tags = {\r\n    Name = \"Ec2-with-VPC\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-with-vpc/provider.tf",
    "content": "provider \"aws\" {\r\n  region  = \"${var.region}\"\r\n  version = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-with-vpc/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-with-vpc/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-ec2-with-vpc/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block                       = var.cidr\r\n  instance_tenancy                 = var.instance_tenancy\r\n  enable_dns_hostnames             = var.enable_dns_hostnames\r\n  enable_dns_support               = var.enable_dns_support\r\n  enable_classiclink               = var.enable_classiclink\r\n\r\n  tags = {\r\n      Name = var.tags\r\n    }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elasticsearch/README.md",
    "content": "# Terraform-Tutorial\r\n\r\n\r\n## Introduction\r\n\r\nThis module will create:\r\n- Elasticsearch cluster with the specified node count in aws\r\n- Elasticsearch domain policy that accepts a list of IAM role ARNs from which to permit management traffic to the cluster\r\n\r\n__NOTE:__ To enable [zone awareness](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html#es-managedomains-zoneawareness) to deploy Elasticsearch nodes into two different Availability Zones, you need to set `zone_awareness_enabled` to `true`\r\nIf you don't enable zone awareness, Amazon ES places an endpoint into only one subnet.\r\n\r\n## Usage\r\n\r\nBasic [example](examples/basic)\r\n\r\n```hcl\r\nmodule \"elasticsearch\" {\r\n  source                  = \"git::https://github.com/easyawslearn/Terraform-Tutorial/terraform-aws-elasticsearch.git\"\r\n  domain_name             = \"eg\"\r\n  elasticsearch_version   = \"6.5\"\r\n  zone_awareness_enabled  = \"false\"\r\n  instance_type           = \"t2.small.elasticsearch\"\r\n  instance_count          = 2\r\n  encrypt_at_rest_enabled = true\r\n\r\n  advanced_options {\r\n    \"rest.action.multi.allow_explicit_index\" = \"true\"\r\n  }\r\n}\r\n```\r\n\r\n\r\n## Developing\r\n\r\n- **Terraform**: v0.11.14\r\n- **Terraform Docs**: https://www.terraform.io/docs/configuration-0-11/index.html\r\n\r\n\r\n\r\n## Inputs\r\n\r\n| Name | Description | Type | Default | Required |\r\n|------|-------------|:----:|:-----:|:-----:|\r\n| advanced_options | Key-value string pairs to specify advanced configuration options | map(string) | `<map>` | no |\r\n| automated_snapshot_start_hour | Hour at which automated snapshots are taken, in UTC | number | `0` | no |\r\n| availability_zone_count | Number of Availability Zones for the domain to use. | number | `2` | no |\r\n| dedicated_master_count | Number of dedicated master nodes in the cluster | number | `0` | no |\r\n| dedicated_master_enabled | Indicates whether dedicated master nodes are enabled for the cluster | bool | `false` | no |\r\n| dedicated_master_type | Instance type of the dedicated master nodes in the cluster | string | `t2.small.elasticsearch` | no |\r\n| ebs_iops | The baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable only for the Provisioned IOPS EBS volume type | number | `0` | no |\r\n| ebs_volume_size | EBS volumes for data storage in GB | number | `0` | no |\r\n| ebs_volume_type | Storage type of EBS volumes | string | `gp2` | no |\r\n| elasticsearch_version | Version of Elasticsearch to deploy | string | `6.5` | no |\r\n| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |\r\n| encrypt_at_rest_enabled | Whether to enable encryption at rest | bool | `true` | no |\r\n| encrypt_at_rest_kms_key_id | The KMS key ID to encrypt the Elasticsearch domain with. If not specified, then it defaults to using the AWS/Elasticsearch service KMS key | string | `` | no |\r\n| instance_count | Number of data nodes in the cluster | number | `4` | no |\r\n| instance_type | Elasticsearch instance type for data nodes in the cluster | string | `t2.small.elasticsearch` | no |\r\n| log_publishing_application_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for ES_APPLICATION_LOGS needs to be published | string | `` | no |\r\n| log_publishing_application_enabled | Specifies whether log publishing option for ES_APPLICATION_LOGS is enabled or not | bool | `false` | no |\r\n| log_publishing_index_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for INDEX_SLOW_LOGS needs to be published | string | `` | no |\r\n| log_publishing_index_enabled | Specifies whether log publishing option for INDEX_SLOW_LOGS is enabled or not | bool | `false` | no |\r\n| log_publishing_search_cloudwatch_log_group_arn | ARN of the CloudWatch log group to which log for SEARCH_SLOW_LOGS needs to be published | string | `` | no |\r\n| log_publishing_search_enabled | Specifies whether log publishing option for SEARCH_SLOW_LOGS is enabled or not | bool | `false` | no |\r\n| domain_name | Name of the application | string | - | yes |\r\n| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |\r\n| node_to_node_encryption_enabled | Whether to enable node-to-node encryption | bool | `false` | no |\r\n| zone_awareness_enabled | Enable zone awareness for Elasticsearch cluster | bool | `true` | no |\r\n\r\n## Outputs\r\n\r\n| Name | Description |\r\n|------|-------------|\r\n| domain_arn | ARN of the Elasticsearch domain |\r\n| domain_endpoint | Domain-specific endpoint used to submit index, search, and data upload requests |\r\n| domain_hostname | Elasticsearch domain hostname to submit index, search, and data upload requests |\r\n| domain_id | Unique identifier for the Elasticsearch domain |\r\n| elasticsearch_user_iam_role_arn | The ARN of the IAM role to allow access to Elasticsearch cluster |\r\n| elasticsearch_user_iam_role_name | The name of the IAM role to allow access to Elasticsearch cluster |\r\n\r\n\r\n\r\n\r\n\r\n## References\r\n\r\nFor additional context, refer to some of these links.\r\n\r\n- [What is Amazon Elasticsearch Service](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/what-is-amazon-elasticsearch-service.html) - Complete description of Amazon Elasticsearch Service\r\n- [Amazon Elasticsearch Service Access Control](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html) - Describes several ways of controlling access to Elasticsearch domains\r\n- [VPC Support for Amazon Elasticsearch Service Domains](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html) - Describes Elasticsearch Service VPC Support and VPC architectures with and without zone awareness\r\n- [Creating and Configuring Amazon Elasticsearch Service Domains](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html) - Provides a complete description on how to create and configure Amazon Elasticsearch Service (Amazon ES) domains\r\n- [Kibana and Logstash](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-kibana.html) - Describes some considerations for using Kibana and Logstash with Amazon Elasticsearch Service\r\n- [Control Access to Amazon Elasticsearch Service Domain](https://aws.amazon.com/blogs/security/how-to-control-access-to-your-amazon-elasticsearch-service-domain/) - Describes how to Control Access to Amazon Elasticsearch Service Domain\r\n- [elasticsearch_domain](https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain.html) - Terraform reference documentation for the `elasticsearch_domain` resource\r\n- [elasticsearch_domain_policy](https://www.terraform.io/docs/providers/aws/r/elasticsearch_domain_policy.html) - Terraform reference documentation for the `elasticsearch_domain_policy` resource\r\n"
  },
  {
    "path": "terraform-aws-elasticsearch/iam_role_policy.tf",
    "content": "\r\n# Role that pods can assume for access to elasticsearch and kibana\r\nresource \"aws_iam_role\" \"elasticsearch_user\" {\r\n  name               = \"module.user_label.id\"\r\n  assume_role_policy = join(\"\", data.aws_iam_policy_document.assume_role.*.json)\r\n  description        = \"IAM Role to assume to access the Elasticsearch module.label.id cluster\"\r\n\r\n  tags = {\r\n    tag-key = \"tag-value\"\r\n  }\r\n}\r\n\r\ndata \"aws_iam_policy_document\" \"assume_role\" {\r\n\r\n  statement {\r\n    actions = [\r\n      \"sts:AssumeRole\"\r\n    ]\r\n\r\n    principals {\r\n      type        = \"Service\"\r\n      identifiers = [\"ec2.amazonaws.com\"]\r\n    }\r\n\r\n    principals {\r\n      type        = \"AWS\"\r\n      identifiers = [\"*\"]\r\n    }\r\n\r\n    effect = \"Allow\"\r\n  }\r\n}\r\n\r\n\r\ndata \"aws_iam_policy_document\" \"default\" {\r\n\r\n  statement {\r\n    actions = [\"es:*\", ]\r\n    resources = [\r\n      join(\"\", aws_elasticsearch_domain.default.*.arn),\r\n      \"${join(\"\", aws_elasticsearch_domain.default.*.arn)}/*\"\r\n    ]\r\n\r\n    principals {\r\n      type        = \"AWS\"\r\n      identifiers = [\"*\"]\r\n    }\r\n  }\r\n}\r\n\r\nresource \"aws_elasticsearch_domain_policy\" \"default\" {\r\n  domain_name     = \"easyaws\"\r\n  access_policies = join(\"\", data.aws_iam_policy_document.default.*.json)\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elasticsearch/main.tf",
    "content": "provider \"aws\" {\r\n  region  = var.region\r\n  version = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_elasticsearch_domain\" \"default\" {\r\n  domain_name           = var.domain_name\r\n  elasticsearch_version = var.elasticsearch_version\r\n\r\n  advanced_options = var.advanced_options\r\n\r\n  ebs_options {\r\n    ebs_enabled = var.ebs_volume_size > 0 ? true : false\r\n    volume_size = var.ebs_volume_size\r\n    volume_type = var.ebs_volume_type\r\n    iops        = var.ebs_iops\r\n  }\r\n\r\n  encrypt_at_rest {\r\n    enabled    = var.encrypt_at_rest_enabled\r\n    kms_key_id = var.encrypt_at_rest_kms_key_id\r\n  }\r\n\r\n  cluster_config {\r\n    instance_count           = var.instance_count\r\n    instance_type            = var.instance_type\r\n    dedicated_master_enabled = var.dedicated_master_enabled\r\n    dedicated_master_count   = var.dedicated_master_count\r\n    dedicated_master_type    = var.dedicated_master_type\r\n    zone_awareness_enabled   = var.zone_awareness_enabled\r\n\r\n    zone_awareness_config {\r\n      availability_zone_count = var.availability_zone_count\r\n    }\r\n  }\r\n\r\n  node_to_node_encryption {\r\n    enabled = var.node_to_node_encryption_enabled\r\n  }\r\n\r\n  snapshot_options {\r\n    automated_snapshot_start_hour = var.automated_snapshot_start_hour\r\n  }\r\n\r\n  log_publishing_options {\r\n    enabled                  = var.log_publishing_index_enabled\r\n    log_type                 = \"INDEX_SLOW_LOGS\"\r\n    cloudwatch_log_group_arn = var.log_publishing_index_cloudwatch_log_group_arn\r\n  }\r\n\r\n  log_publishing_options {\r\n    enabled                  = var.log_publishing_search_enabled\r\n    log_type                 = \"SEARCH_SLOW_LOGS\"\r\n    cloudwatch_log_group_arn = var.log_publishing_search_cloudwatch_log_group_arn\r\n  }\r\n\r\n  log_publishing_options {\r\n    enabled                  = var.log_publishing_application_enabled\r\n    log_type                 = \"ES_APPLICATION_LOGS\"\r\n    cloudwatch_log_group_arn = var.log_publishing_application_cloudwatch_log_group_arn\r\n  }\r\n\r\n  tags = {\r\n    Domain = \"TestDomain\"\r\n  }\r\n\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elasticsearch/output.tf",
    "content": "\r\noutput \"domain_arn\" {\r\n  value       = join(\"\", aws_elasticsearch_domain.default.*.arn)\r\n  description = \"ARN of the Elasticsearch domain\"\r\n}\r\n\r\noutput \"domain_id\" {\r\n  value       = join(\"\", aws_elasticsearch_domain.default.*.domain_id)\r\n  description = \"Unique identifier for the Elasticsearch domain\"\r\n}\r\n\r\noutput \"domain_endpoint\" {\r\n  value       = join(\"\", aws_elasticsearch_domain.default.*.endpoint)\r\n  description = \"Domain-specific endpoint used to submit index, search, and data upload requests\"\r\n}\r\n\r\noutput \"elasticsearch_user_iam_role_name\" {\r\n  value       = join(\",\", aws_iam_role.elasticsearch_user.*.name)\r\n  description = \"The name of the IAM role to allow access to Elasticsearch cluster\"\r\n}\r\n\r\noutput \"elasticsearch_user_iam_role_arn\" {\r\n  value       = join(\",\", aws_iam_role.elasticsearch_user.*.arn)\r\n  description = \"The ARN of the IAM role to allow access to Elasticsearch cluster\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elasticsearch/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-2\"\r\n}\r\n\r\nvariable \"domain_name\" {\r\n  type        = string\r\n  default     = \"easyaws\"\r\n  description = \"name of Elasticsearch Domain\"\r\n}\r\n\r\nvariable \"elasticsearch_version\" {\r\n  type        = string\r\n  default     = \"6.5\"\r\n  description = \"Version of Elasticsearch to deploy\"\r\n}\r\n\r\nvariable \"instance_type\" {\r\n  type        = string\r\n  default     = \"t2.small.elasticsearch\"\r\n  description = \"Elasticsearch instance type for data nodes in the cluster\"\r\n}\r\n\r\nvariable \"instance_count\" {\r\n  type        = number\r\n  description = \"Number of data nodes in the cluster\"\r\n  default     = 1\r\n}\r\n\r\nvariable \"zone_awareness_enabled\" {\r\n  type        = bool\r\n  default     = true\r\n  description = \"Enable zone awareness for Elasticsearch cluster\"\r\n}\r\n\r\nvariable \"availability_zone_count\" {\r\n  type        = number\r\n  default     = 2\r\n  description = \"Number of Availability Zones for the domain to use.\"\r\n}\r\n\r\nvariable \"ebs_volume_size\" {\r\n  type        = number\r\n  description = \"EBS volumes for data storage in GB\"\r\n  default     = 20\r\n}\r\n\r\nvariable \"ebs_volume_type\" {\r\n  type        = string\r\n  default     = \"gp2\"\r\n  description = \"Storage type of EBS volumes\"\r\n}\r\n\r\nvariable \"ebs_iops\" {\r\n  type        = number\r\n  default     = 0\r\n  description = \"The baseline input/output (I/O) performance of EBS volumes attached to data nodes. Applicable only for the Provisioned IOPS EBS volume type\"\r\n}\r\n\r\nvariable \"encrypt_at_rest_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Whether to enable encryption at rest\"\r\n}\r\n\r\nvariable \"encrypt_at_rest_kms_key_id\" {\r\n  type        = string\r\n  default     = \"\"\r\n  description = \"The KMS key ID to encrypt the Elasticsearch domain with. If not specified, then it defaults to using the AWS/Elasticsearch service KMS key\"\r\n}\r\n\r\nvariable \"log_publishing_index_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Specifies whether log publishing option for INDEX_SLOW_LOGS is enabled or not\"\r\n}\r\n\r\nvariable \"log_publishing_search_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Specifies whether log publishing option for SEARCH_SLOW_LOGS is enabled or not\"\r\n}\r\n\r\nvariable \"log_publishing_application_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Specifies whether log publishing option for ES_APPLICATION_LOGS is enabled or not\"\r\n}\r\n\r\nvariable \"log_publishing_index_cloudwatch_log_group_arn\" {\r\n  type        = string\r\n  default     = \"\"\r\n  description = \"ARN of the CloudWatch log group to which log for INDEX_SLOW_LOGS needs to be published\"\r\n}\r\n\r\nvariable \"log_publishing_search_cloudwatch_log_group_arn\" {\r\n  type        = string\r\n  default     = \"\"\r\n  description = \"ARN of the CloudWatch log group to which log for SEARCH_SLOW_LOGS needs to be published\"\r\n}\r\n\r\nvariable \"log_publishing_application_cloudwatch_log_group_arn\" {\r\n  type        = string\r\n  default     = \"\"\r\n  description = \"ARN of the CloudWatch log group to which log for ES_APPLICATION_LOGS needs to be published\"\r\n}\r\n\r\nvariable \"automated_snapshot_start_hour\" {\r\n  type        = number\r\n  description = \"Hour at which automated snapshots are taken, in UTC\"\r\n  default     = 0\r\n}\r\n\r\nvariable \"dedicated_master_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Indicates whether dedicated master nodes are enabled for the cluster\"\r\n}\r\n\r\nvariable \"dedicated_master_count\" {\r\n  type        = number\r\n  description = \"Number of dedicated master nodes in the cluster\"\r\n  default     = 0\r\n}\r\n\r\nvariable \"dedicated_master_type\" {\r\n  type        = string\r\n  default     = \"t2.small.elasticsearch\"\r\n  description = \"Instance type of the dedicated master nodes in the cluster\"\r\n}\r\n\r\nvariable \"advanced_options\" {\r\n  type        = map(string)\r\n  default     = {}\r\n  description = \"Key-value string pairs to specify advanced configuration options\"\r\n}\r\n\r\n\r\nvariable \"node_to_node_encryption_enabled\" {\r\n  type        = bool\r\n  default     = false\r\n  description = \"Whether to enable node-to-node encryption\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/elb.tf",
    "content": "provider \"aws\" {\r\n  region = var.region\r\n}\r\n\r\nresource \"aws_lb\" \"elb_example\" {\r\n  name               = \"elb\"\r\n  internal           = false\r\n  load_balancer_type = \"application\"\r\n  security_groups    = [aws_security_group.elb_sg.id]\r\n  subnets            = [aws_subnet.public_1.id,aws_subnet.public_2.id]\r\n\r\n  enable_deletion_protection = true\r\n    tags = {\r\n    Environment = \"elb-example\"\r\n  }\r\n}\r\n\r\nresource \"aws_lb_listener\" \"front_end\" {\r\n  load_balancer_arn = aws_lb.elb_example.arn\r\n  port              = \"80\"\r\n  protocol          = \"HTTP\"\r\n\r\n  default_action {\r\n    type = \"forward\"\r\n    target_group_arn = aws_lb_target_group.test.arn\r\n\r\n    }\r\n}\r\n\r\nresource \"aws_lb_target_group\" \"test\" {\r\n  name     = \"tf-example-lb-tg\"\r\n  port     = 80\r\n  protocol = \"HTTP\"\r\n  target_type=\"instance\"\r\n  vpc_id   = aws_vpc.vpc_demo.id\r\n}\r\n\r\nresource \"aws_lb_target_group_attachment\" \"test\" {\r\n  target_group_arn = aws_lb_target_group.test.arn\r\n  target_id        = aws_instance.elb_instance_example1.id\r\n  port             = 80\r\n}\r\nresource \"aws_lb_target_group_attachment\" \"test1\" {\r\n  target_group_arn = aws_lb_target_group.test.arn\r\n  target_id        = aws_instance.elb_instance_example2.id\r\n  port             = 80\r\n}\r\n\r\n\r\noutput \"elb_example\" {\r\n  description = \"The DNS name of the ELB\"\r\n  value       = aws_lb.elb_example.dns_name\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/instances.tf",
    "content": "resource \"aws_instance\" \"elb_instance_example1\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.elb_sg.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n\t\t#! /bin/bash\r\n                sudo yum update -y\r\n\t\tsudo yum install -y httpd.x86_64\r\n\t\tsudo service httpd start\r\n\t\tsudo service httpd enable\r\n\t\techo \"<h1>Deployed ELB Instance Example 1</h1>\" | sudo tee /var/www/html/index.html\r\n\tEOF\r\n\r\n  tags = {\r\n    Name = \"EC2-Instance-1\"\r\n  }\r\n}\r\n\r\nresource \"aws_instance\" \"elb_instance_example2\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.elb_sg.id]\r\n\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n\t\t#! /bin/bash\r\n                sudo yum update -y\r\n\t\tsudo yum install -y httpd.x86_64\r\n\t\tsudo service httpd start\r\n\t\tsudo service httpd enable\r\n\t\techo \"<h1>Deployed ELB Instance Example 2</h1>\" | sudo tee /var/www/html/index.html\r\n\tEOF\r\n\r\n  tags = {\r\n    Name = \"EC2-Instance-1\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/route53.tf",
    "content": "resource \"aws_route53_zone\" \"easy_aws\" {\r\n  name = \"easyaws.in\"\r\n\r\n  tags = {\r\n    Environment = \"dev\"\r\n  }\r\n}\r\n\r\nresource \"aws_route53_record\" \"www\" {\r\n  zone_id = aws_route53_zone.easy_aws.zone_id\r\n  name    = \"www.easyaws.in\"\r\n  type    = \"A\"\r\n\r\n  alias {\r\n     name                   = aws_lb.elb_example.dns_name\r\n     zone_id                = aws_lb.elb_example.zone_id\r\n     evaluate_target_health = true\r\n   }\r\n\r\n}\r\n\r\noutput \"name_server\"{\r\n  value=aws_route53_zone.easy_aws.name_servers\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/security_group.tf",
    "content": "resource \"aws_security_group\" \"elb_sg\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 22 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    us-east-2    = \"ami-02ccb28830b645a41\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-elb-alb/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block           = var.cidr\r\n  instance_tenancy     = var.instance_tenancy\r\n  enable_dns_hostnames = var.enable_dns_hostnames\r\n  enable_dns_support   = var.enable_dns_support\r\n  enable_classiclink   = var.enable_classiclink\r\n\r\n  tags = {\r\n    Name = var.tags\r\n  }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone       = \"us-east-1a\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_2\" {\r\n  availability_zone       = \"us-east-1b\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.2.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_2\" {\r\n  subnet_id      = aws_subnet.public_2.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n"
  },
  {
    "path": "terraform-aws-iam/iam/aws_iam_group.tf",
    "content": "resource \"aws_iam_group\" \"admin\" {\r\n  name = \"developer-admin-group\"\r\n}\r\n\r\nresource \"aws_iam_policy_attachment\" \"admin-attach\" {\r\n  name       = \"admin-attachment\"\r\n  groups     = [aws_iam_group.admin.name]\r\n  policy_arn = \"arn:aws:iam::aws:policy/AdministratorAccess\"\r\n}\r\n# Customer Policy Attachment\r\nresource \"aws_iam_group\" \"custom_admin\" {\r\n  name = \"developer-admin-grp-custom-policy-example\"\r\n}\r\nresource \"aws_iam_group_policy\" \"Custom_developer_admin_policy\" {\r\n  name  = \"my_developer_policy\"\r\n  group = aws_iam_group.custom_admin.name\r\n\r\n  policy = <<EOF\r\n{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Action\": \"*\",\r\n      \"Effect\": \"Allow\",\r\n      \"Resource\": \"*\"\r\n    }\r\n  ]\r\n}\r\nEOF\r\n}\r\n\r\nresource \"aws_iam_user_group_membership\" \"admin-users\" {\r\n  user = aws_iam_user.demo-user.name\r\n\r\n  groups = [\r\n    aws_iam_group.admin.name\r\n  ]\r\n}\r\n\r\nresource \"aws_iam_user_group_membership\" \"admin-users1\" {\r\n  user = aws_iam_user.demo-user1.name\r\n\r\n  groups = [\r\n    aws_iam_group.admin.name\r\n  ]\r\n}\r\nresource \"aws_iam_user\" \"demo-user\" {\r\n  name = \"demo-user\"\r\n}\r\n\r\nresource \"aws_iam_user\" \"demo-user1\" {\r\n  name = \"demo-user1\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-iam/iam/main.tf",
    "content": "provider \"aws\" {\r\n  region     = \"eu-west-1\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-iam/iam_role_with_instance/instance.tf",
    "content": "\r\nresource \"aws_instance\" \"iam_role_instance_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  iam_instance_profile = aws_iam_instance_profile.ec2_profile.name\r\n  # key name\r\n  key_name = var.key_name\r\n  # User data passing through template rendering\r\n\r\n  tags = {\r\n    Name = \"Roles with Ec2\"\r\n  }\r\n}\r\n\r\noutput \"public_ip\" {\r\n  value = aws_instance.iam_role_instance_example.public_ip\r\n}\r\n"
  },
  {
    "path": "terraform-aws-iam/iam_role_with_instance/main.tf",
    "content": "provider \"aws\" {\r\n  region     = var.region\r\n}\r\n\r\nresource \"aws_iam_role\" \"s3_access_role\" {\r\n  name = \"s3-access-role\"\r\n\r\n  assume_role_policy = <<EOF\r\n{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Action\": \"sts:AssumeRole\",\r\n      \"Principal\": {\r\n        \"Service\": \"ec2.amazonaws.com\"\r\n      },\r\n      \"Effect\": \"Allow\",\r\n      \"Sid\": \"\"\r\n    }\r\n  ]\r\n}\r\nEOF\r\n \r\n}\r\n\r\nresource \"aws_iam_instance_profile\" \"ec2_profile\" {\r\n  name = \"ec2_profile\"\r\n  role = aws_iam_role.s3_access_role.name\r\n}\r\n\r\nresource \"aws_iam_role_policy\" \"s3_bcuket_access_policy\" {\r\n  name = \"s3_bcuket_access_policy\"\r\n  role = aws_iam_role.s3_access_role.id\r\n\r\n   policy = <<-EOF\r\n  {\r\n    \"Version\": \"2012-10-17\",\r\n    \"Statement\": [\r\n      {\r\n        \"Action\": [\r\n          \"s3:*\"\r\n        ],\r\n        \"Effect\": \"Allow\",\r\n        \"Resource\": [\r\n          \"arn:aws:s3:::iambucketdemo-dfredf\",\r\n          \"arn:aws:s3:::iambucketdemo-dfredf/*\"\r\n          ]\r\n      }\r\n    ]\r\n  }\r\n  EOF\r\n}\r\n"
  },
  {
    "path": "terraform-aws-iam/iam_role_with_instance/s3_bucket.tf",
    "content": "resource \"aws_s3_bucket\" \"iam_demo_bucket_name\" {\r\n    bucket = \"iambucketdemo-dfredf\"\r\n    acl=\"private\"\r\n\r\n    tags = {\r\n    Name        = \"My bucket\"\r\n    Environment = \"Demo\"\r\n  }\r\n  \r\n}"
  },
  {
    "path": "terraform-aws-iam/iam_role_with_instance/variables.tf",
    "content": "variable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\n\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-04d29b6f966df1537\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\n\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\n\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-private-public-ip/instance.tf",
    "content": "provider \"aws\" {\r\n  region     = var.region\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_instance\" \"IP_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh.id]\r\n  private_ip = \"10.0.1.10\"\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n    #! /bin/bash\r\n                sudo yum update -y\r\n    sudo yum install -y httpd.x86_64\r\n    sudo service httpd start\r\n    sudo service httpd enable\r\n    echo \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n  EOF\r\n\r\n  tags = {\r\n    Name = \"Private_IP\"\r\n  }\r\n}\r\n\r\nresource \"aws_eip\" \"eip\" {\r\n  instance = aws_instance.IP_example.id\r\n  vpc      = true\r\n}\r\n\r\noutput \"public_ip\" {\r\n  value = aws_instance.IP_example.public_ip\r\n}\r\n"
  },
  {
    "path": "terraform-aws-private-public-ip/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"device_name\" {\r\n  type    = \"string\"\r\n  default = \"/dev/xvdh\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-private-public-ip/vpc.tf",
    "content": "resource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block           = var.cidr\r\n  instance_tenancy     = var.instance_tenancy\r\n  enable_dns_hostnames = var.enable_dns_hostnames\r\n  enable_dns_support   = var.enable_dns_support\r\n  enable_classiclink   = var.enable_classiclink\r\n\r\n  tags = {\r\n    Name = var.tags\r\n  }\r\n}\r\n\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone       = \"us-east-1a\"\r\n  vpc_id                  = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block              = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = aws_vpc.vpc_demo.id\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = aws_internet_gateway.gw.id\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = aws_subnet.public_1.id\r\n  route_table_id = aws_route_table.route-public.id\r\n}\r\n\r\nresource \"aws_security_group\" \"allow_ssh\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 80 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-dynamoDb/dynamodb.tf",
    "content": "provider \"aws\" {\r\n  region     = \"us-east-1\"\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_dynamodb_table\" \"basic-dynamodb-table\" {\r\n  name           = \"DynamoDB-Terraform\"\r\n  billing_mode   = \"PROVISIONED\"\r\n  read_capacity  = 20\r\n  write_capacity = 20\r\n  hash_key       = \"UserId\"\r\n  range_key      = \"Name\"\r\n\r\n  attribute {\r\n    name = \"UserId\"\r\n    type = \"S\"\r\n  }\r\n\r\n  attribute {\r\n    name = \"Name\"\r\n    type = \"S\"\r\n  }\r\n\r\n  ttl {\r\n    attribute_name = \"TimeToExist\"\r\n    enabled        = false\r\n  }\r\n\r\n  global_secondary_index {\r\n    name               = \"UserTitleIndex\"\r\n    hash_key           = \"UserId\"\r\n    range_key          = \"Name\"\r\n    write_capacity     = 10\r\n    read_capacity      = 10\r\n    projection_type    = \"INCLUDE\"\r\n    non_key_attributes = [\"UserId\"]\r\n  }\r\n\r\n  tags = {\r\n    Name        = \"dynamodb-table\"\r\n    Environment = \"Training\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-mariaDb/instance.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\n\r\nresource \"aws_instance\" \"rds_example\" {\r\n  ami           = lookup(var.ami_id, var.region)\r\n  instance_type = var.instance_type\r\n  subnet_id     = aws_subnet.public_1.id\r\n\r\n  # Security group assign to instance\r\n  vpc_security_group_ids = [aws_security_group.allow_ssh_http.id]\r\n  availability_zone=\"us-east-1a\"\r\n  # key name\r\n  key_name = var.key_name\r\n\r\n  user_data = <<EOF\r\n    #! /bin/bash\r\n                sudo yum update -y\r\n    sudo yum install -y httpd.x86_64\r\n    sudo service httpd start\r\n    sudo service httpd enable\r\n    echo \"<h1>Deployed via Terraform</h1>\" | sudo tee /var/www/html/index.html\r\n  EOF\r\n\r\n  tags = {\r\n    Name = \"RDS_MariaDB_Example\"\r\n  }\r\n}\r\n\r\n\r\noutput \"public_ip\" {\r\n  value = aws_instance.rds_example.public_ip\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-mariaDb/mariadb.tf",
    "content": "resource \"aws_db_parameter_group\" \"default\" {\r\n  name   = \"mariadb\"\r\n  family = \"mariadb10.2\"\r\n\r\n  parameter {\r\n    name  = \"max_allowed_packet\"\r\n    value = \"16777216\"\r\n  }\r\n}\r\n\r\nresource \"aws_db_subnet_group\" \"default\" {\r\n  name       = \"main\"\r\n  subnet_ids = [aws_subnet.private_1.id, aws_subnet.private_2.id]\r\n\r\n  tags = {\r\n    Name = \"My DB subnet group\"\r\n  }\r\n}\r\n\r\nresource \"aws_db_instance\" \"default\" {\r\n  allocated_storage    = 20\r\n  storage_type         = \"gp2\"\r\n  engine               = \"mariadb\"\r\n  engine_version       = \"10.2.21\"\r\n  instance_class       = \"db.t2.micro\"\r\n  name                 = \"mydb\"\r\n  username             = \"root\"\r\n  password             = \"foobarbaz\"\r\n  parameter_group_name = \"mariadb\"\r\n  db_subnet_group_name=aws_db_subnet_group.default.name\r\n  vpc_security_group_ids=[aws_security_group.db.id]\r\n  availability_zone=aws_subnet.private_1.availability_zone\r\n}\r\n\r\noutput \"end_point\" {\r\n  value = aws_db_instance.default.endpoint\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-mariaDb/security_group.tf",
    "content": "resource \"aws_security_group\" \"allow_ssh_http\" {\r\n  name        = \"allow_SSH_http\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 22\r\n    to_port     = 22\r\n    protocol    = \"tcp\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n\r\n    ingress {\r\n      # SSH Port 80 allowed from any IP\r\n      from_port   = 80\r\n      to_port     = 80\r\n      protocol    = \"tcp\"\r\n      cidr_blocks = [\"0.0.0.0/0\"]\r\n    }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n\r\nresource \"aws_security_group\" \"db\" {\r\n  name        = \"allow_SSH\"\r\n  description = \"Allow SSH inbound traffic\"\r\n  vpc_id      = aws_vpc.vpc_demo.id\r\n\r\n  ingress {\r\n    # SSH Port 22 allowed from any IP\r\n    from_port   = 3306\r\n    to_port     = 3306\r\n    protocol    = \"tcp\"\r\n    security_groups =[aws_security_group.allow_ssh_http.id]\r\n  }\r\n\r\n  egress {\r\n    from_port   = 0\r\n    to_port     = 0\r\n    protocol    = \"-1\"\r\n    cidr_blocks = [\"0.0.0.0/0\"]\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-mariaDb/variables.tf",
    "content": "variable \"region\" {\r\n  type    = \"string\"\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn75gd33\"\r\n  }\r\n}\r\nvariable \"instance_type\" {\r\n  type    = \"string\"\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"device_name\" {\r\n  type    = \"string\"\r\n  default = \"/dev/xvdh\"\r\n}\r\nvariable \"key_name\" {\r\n  type    = \"string\"\r\n  default = \"ec2-demo\"\r\n}\r\n\r\nvariable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-rds-mariaDb/vpc.tf",
    "content": "######\r\n# VPC\r\n######\r\n#terraform version >= 12\r\n############\r\nresource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block                       = var.cidr\r\n  instance_tenancy                 = var.instance_tenancy\r\n  enable_dns_hostnames             = var.enable_dns_hostnames\r\n  enable_dns_support               = var.enable_dns_support\r\n  enable_classiclink               = var.enable_classiclink\r\n\r\n  tags = {\r\n      Name = var.tags\r\n    }\r\n\r\n}\r\nresource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n\r\n\r\nresource \"aws_subnet\" \"private_1\" {\r\n  availability_zone = \"us-east-1a\"\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.4.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_1-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"private_2\" {\r\n  availability_zone = \"us-east-1b\"\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.5.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_2-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"private_3\" {\r\n  availability_zone = \"us-east-1c\"\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.6.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_3-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"public_1\" {\r\n  availability_zone = \"us-east-1a\"\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"public_2\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  availability_zone = \"us-east-1b\"\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.2.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_2-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"public_3\" {\r\n  availability_zone = \"us-east-1c\"\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.3.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_3-demo\"\r\n  }\r\n}\r\nresource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = \"${aws_internet_gateway.gw.id}\"\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = \"${aws_subnet.public_1.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_2\" {\r\n  subnet_id      = \"${aws_subnet.public_2.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_3\" {\r\n  subnet_id      = \"${aws_subnet.public_3.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n\r\nresource \"aws_route_table\" \"route_private\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  tags = {\r\n    Name = \"private-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"private_1\" {\r\n  subnet_id      = \"${aws_subnet.private_1.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\nresource \"aws_route_table_association\" \"private_2\" {\r\n  subnet_id      = \"${aws_subnet.private_2.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\nresource \"aws_route_table_association\" \"private_3\" {\r\n  subnet_id      = \"${aws_subnet.private_3.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-sns/example/.terraform.lock.hcl",
    "content": "# This file is maintained automatically by \"terraform init\".\n# Manual edits may be lost in future updates.\n\nprovider \"registry.terraform.io/hashicorp/aws\" {\n  version     = \"4.22.0\"\n  constraints = \">= 3.1.15\"\n  hashes = [\n    \"h1:KOsejPSvd2eEfuhtbLilFMnQZlaOJ53p7/NR+4qSibo=\",\n    \"zh:299efb8ba733b7742f0ef1c5c5467819e0c7bf46264f5f36ba6b6674304a5244\",\n    \"zh:4db198a41d248491204d4ca644662c32f748177d5cbe01f3c7adbb957d4d77f0\",\n    \"zh:62ebc2b05b25eafecb1a75f19d6fc5551faf521ada9df9e5682440d927f642e1\",\n    \"zh:636b590840095b4f817c176034cf649f543c0ce514dc051d6d0994f0a05c53ef\",\n    \"zh:8594bd8d442288873eee56c0b4535cbdf02cacfcf8f6ddcf8cd5f45bb1d3bc80\",\n    \"zh:8e18a370949799f20ba967eec07a84aaedf95b3ee5006fe5af6eae13fbf39dc3\",\n    \"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425\",\n    \"zh:aa968514231e404fb53311d8eae2e8b6bde1fdad1f4dd5a592ab93d9cbf11af4\",\n    \"zh:af8e5c48bf36d4fff1a6fca760d5b85f14d657cbdf95e9cd5e898c68104bad31\",\n    \"zh:d8a75ba36bf8b6f2e49be5682f48eccb6c667a4484afd676ae347213ae208622\",\n    \"zh:dd7c419674a47e587dabe98b150a8f1f7e31c248c68e8bf5e9ca0a400b5e2c4e\",\n    \"zh:fdeb6314a2ce97489bbbece59511f78306955e8a23b02cbd1485bd04185a3673\",\n  ]\n}\n"
  },
  {
    "path": "terraform-aws-sns/example/example.tf",
    "content": "provider \"aws\" {\n  region = \"eu-west-1\"\n}\n\nmodule \"sns_cloudwatch\" {\n  source = \"github.com/easyawslearn/Terraform-Tutorial/terraform-aws-sns\"\n  cloudwatch_event_rule_name        = \"capture-aws-sign-in\"\n  description = \"Capture each AWS Console Sign In\"\n  sns_name = \"mysns\"\n  sns_display_name = \"demosns\"\n  lambda_function_name = \"S3cloudHub_Test_Lambda_Function\"\n  lambda_function_runtime = \"python3.8\"\n}\n"
  },
  {
    "path": "terraform-aws-sns/example/version.tf",
    "content": "# Terraform version\nterraform {\n  required_version = \">= 0.14.11\"\n\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \">= 3.1.15\"\n    }\n  }\n}\n\n"
  },
  {
    "path": "terraform-aws-sns/main.tf",
    "content": "provider \"aws\" {\n  region = var.region\n}\n\nresource \"aws_cloudwatch_event_rule\" \"default\" {\n    count = var.enabled == true ? 1 : 0\n\n  name          = var.cloudwatch_event_rule_name\n  description   = var.description\n  event_pattern = <<EOF\n{\n  \"detail-type\": [\n    \"AWS Console Sign In via CloudTrail\"\n  ]\n}\nEOF\n  role_arn   = var.role_arn\n  is_enabled = var.is_enabled\n}\n\nresource \"aws_cloudwatch_event_target\" \"default\" {\n  count      = var.enabled == true ? 1 : 0\n  rule       = aws_cloudwatch_event_rule.default.*.name[0]\n  target_id  = var.target_id\n  arn        = aws_sns_topic.this[count.index].arn\n  input_path = var.input_path != \"\" ? var.input_path : null\n  role_arn   = var.target_role_arn\n}\n\nresource \"aws_sns_topic\" \"this\" {\n  count = var.enabled ? 1 : 0\n\n  name                        = var.sns_name\n  display_name                = var.sns_display_name\n  kms_master_key_id           = var.kms_master_key_id\n  delivery_policy             = var.delivery_policy\n  fifo_topic                  = var.fifo_topic\n  content_based_deduplication = var.content_based_deduplication\n}\n\nresource \"aws_sns_topic_subscription\" \"this\" {\n  for_each = var.enabled ? var.subscribers : {}\n\n  topic_arn              = join(\"\", aws_sns_topic.this.*.arn)\n  protocol               = var.subscribers[each.key].protocol\n  endpoint               = aws_lambda_function.terraform_lambda_func.arn\n  endpoint_auto_confirms = var.subscribers[each.key].endpoint_auto_confirms\n  raw_message_delivery   = var.subscribers[each.key].raw_message_delivery\n}\n\nresource \"aws_sns_topic_policy\" \"default\" {\n  count = var.sns_topic_policy_enabled ? 1 : 0\n\n  arn    = aws_sns_topic.this[count.index].arn\n  policy = data.aws_iam_policy_document.sns_topic_policy[count.index].json\n}\n\ndata \"aws_iam_policy_document\" \"sns_topic_policy\" {\n  count = var.sns_topic_policy_enabled ? 1 : 0\n  statement {\n    effect  = \"Allow\"\n    actions = [\"SNS:Publish\"]\n\n    principals {\n      type        = \"Service\"\n      identifiers = [\"events.amazonaws.com\"]\n    }\n\n    resources = [aws_sns_topic.this[count.index].arn]\n  }\n}\n\nresource \"aws_iam_role\" \"lambda_role\" {\n  name               = \"S3cloudHub_Test_Lambda_Function_Role\"\n  assume_role_policy = <<EOF\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n   {\n     \"Action\": \"sts:AssumeRole\",\n     \"Principal\": {\n       \"Service\": \"lambda.amazonaws.com\"\n     },\n     \"Effect\": \"Allow\",\n     \"Sid\": \"\"\n   }\n ]\n}\nEOF\n}\nresource \"aws_iam_policy\" \"iam_policy_for_lambda\" {\n\n  name        = \"aws_iam_policy_for_terraform_aws_lambda_role\"\n  path        = \"/\"\n  description = \"AWS IAM Policy for managing aws lambda role\"\n  policy      = <<EOF\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n   {\n     \"Action\": [\n       \"logs:CreateLogGroup\",\n       \"logs:CreateLogStream\",\n       \"logs:PutLogEvents\"\n     ],\n     \"Resource\": \"arn:aws:logs:*:*:*\",\n     \"Effect\": \"Allow\"\n   }\n ]\n}\nEOF\n}\n\nresource \"aws_iam_role_policy_attachment\" \"attach_iam_policy_to_iam_role\" {\n  role       = aws_iam_role.lambda_role.name\n  policy_arn = aws_iam_policy.iam_policy_for_lambda.arn\n}\n\ndata \"archive_file\" \"zip_the_python_code\" {\n  type        = \"zip\"\n  source_dir  = \"${path.module}/python/\"\n  output_path = \"${path.module}/python/hello-python.zip\"\n}\n\nresource \"aws_lambda_function\" \"terraform_lambda_func\" {\n  filename      = \"${path.module}/python/hello-python.zip\"\n  function_name = var.lambda_function_name\n  role          = aws_iam_role.lambda_role.arn\n  handler       = \"index.lambda_handler\"\n  runtime       = var.lambda_function_runtime\n  depends_on    = [aws_iam_role_policy_attachment.attach_iam_policy_to_iam_role]\n}"
  },
  {
    "path": "terraform-aws-sns/python/hello-python.py",
    "content": "def lambda_handler(event, context):\n   message = 'Hello {} !'.format(event['key1'])\n   return {\n       'message' : message\n   }"
  },
  {
    "path": "terraform-aws-sns/variable.tf",
    "content": "variable \"region\" {\n  type    = string\n  default = \"eu-west-1\"\n}\n\nvariable \"enabled\" {\n  type    = bool\n  default = true\n}\n\nvariable \"sns_topic_policy_enabled\" {\n  type    = bool\n  default = true\n}\n\nvariable \"lambda_function_name\" {\n  type = string\n  default = \"\"\n}\n\nvariable \"lambda_function_runtime\" {\n  type = string\n  default = \"\"\n}\n\nvariable \"sns_display_name\" {\n  type    = string\n  default = \"\"\n}\n\nvariable \"cloudwatch_event_rule_name\" {\n  type        = string\n  default     = \"\"\n  description = \"Name  (e.g. `app` or `cluster`).\"\n}\n\nvariable \"description\" {\n  type        = string\n  default     = \"\"\n  description = \"The description for the rule.\"\n}\n\nvariable \"role_arn\" {\n  type        = string\n  default     = \"\"\n  description = \"The Amazon Resource Name (ARN) associated with the role that is used for target invocation.\"\n}\n\nvariable \"is_enabled\" {\n  type        = bool\n  default     = true\n  description = \"Whether the rule should be enabled (defaults to true).\"\n}\n\nvariable \"target_id\" {\n  type        = string\n  default     = \"SendToSNS\"\n  description = \"The Amazon Resource Name (ARN) associated with the role that is used for target invocation.\"\n}\n\nvariable \"arn\" {\n  type        = string\n  default     = \"\"\n  description = \"The Amazon Resource Name (ARN) associated with the role that is used for target invocation.\"\n}\n\nvariable \"input_path\" {\n  type        = string\n  default     = \"\"\n  description = \"The value of the JSONPath that is used for extracting part of the matched event when passing it to the target.\"\n}\n\nvariable \"target_role_arn\" {\n  type        = string\n  default     = \"\"\n  description = \"The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if ecs_target is used.\"\n}\n\nvariable \"input_paths\" {\n  type        = map(any)\n  default     = {}\n  description = \"Key value pairs specified in the form of JSONPath (for example, time = $.time)\"\n\n}\n\nvariable \"sns_name\" {\n  type        = string\n  default     = \"\"\n  description = \"Name  (e.g. `app` or `cluster`).\"\n}\n\nvariable \"subscribers\" {\n  type = map(object({\n    protocol = string\n    # The protocol to use. The possible values for this are: sqs, sms, lambda, application. (http or https are partially supported, see below) (email is an option but is unsupported, see below).\n    endpoint = string\n    # The endpoint to send data to, the contents will vary with the protocol. (see below for more information)\n    endpoint_auto_confirms = bool\n    # Boolean indicating whether the end point is capable of auto confirming subscription e.g., PagerDuty (default is false)\n    raw_message_delivery = bool\n    # Boolean indicating whether or not to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property) (default is false)\n  }))\n  description = \"Required configuration for subscibres to SNS topic.\"\n  default     = {}\n}\n\nvariable \"allowed_aws_services_for_sns_published\" {\n  type        = list(string)\n  description = \"AWS services that will have permission to publish to SNS topic. Used when no external JSON policy is used\"\n  default     = []\n}\n\nvariable \"kms_master_key_id\" {\n  type        = string\n  description = \"The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK.\"\n  default     = \"alias/aws/sns\"\n}\n\nvariable \"encryption_enabled\" {\n  type        = bool\n  description = \"Whether or not to use encryption for SNS Topic. If set to `true` and no custom value for KMS key (kms_master_key_id) is provided, it uses the default `alias/aws/sns` KMS key.\"\n  default     = true\n}\n\nvariable \"sqs_queue_kms_master_key_id\" {\n  type        = string\n  description = \"The ID of an AWS-managed customer master key (CMK) for Amazon SQS Queue or a custom CMK\"\n  default     = \"alias/aws/sqs\"\n}\n\nvariable \"sqs_queue_kms_data_key_reuse_period_seconds\" {\n  type        = number\n  description = \"The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again\"\n  default     = 300\n}\n\nvariable \"allowed_iam_arns_for_sns_publish\" {\n  type        = list(string)\n  description = \"IAM role/user ARNs that will have permission to publish to SNS topic. Used when no external json policy is used.\"\n  default     = []\n}\n\nvariable \"sns_topic_policy_json\" {\n  type        = string\n  description = \"The fully-formed AWS policy as JSON\"\n  default     = \"\"\n}\n\nvariable \"sqs_dlq_enabled\" {\n  type        = bool\n  description = \"Enable delivery of failed notifications to SQS and monitor messages in queue.\"\n  default     = false\n}\n\nvariable \"sqs_dlq_max_message_size\" {\n  type        = number\n  description = \"The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB).\"\n  default     = 262144\n}\n\nvariable \"sqs_dlq_message_retention_seconds\" {\n  type        = number\n  description = \"The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days).\"\n  default     = 1209600\n}\n\nvariable \"delivery_policy\" {\n  type        = string\n  description = \"The SNS delivery policy as JSON.\"\n  default     = null\n}\n\nvariable \"fifo_topic\" {\n  type        = bool\n  description = \"Whether or not to create a FIFO (first-in-first-out) topic\"\n  default     = false\n}\n\nvariable \"fifo_queue_enabled\" {\n  type        = bool\n  description = \"Whether or not to create a FIFO (first-in-first-out) queue\"\n  default     = false\n}\n\nvariable \"content_based_deduplication\" {\n  type        = bool\n  description = \"Enable content-based deduplication for FIFO topics\"\n  default     = false\n}\n\nvariable \"redrive_policy_max_receiver_count\" {\n  type        = number\n  description = \"The number of times a message is delivered to the source queue before being moved to the dead-letter queue. When the ReceiveCount for a message exceeds the maxReceiveCount for a queue, Amazon SQS moves the message to the dead-letter-queue.\"\n  default     = 5\n}\n\nvariable \"redrive_policy\" {\n  type        = string\n  description = \"The SNS redrive policy as JSON. This overrides `var.redrive_policy_max_receiver_count` and the `deadLetterTargetArn` (supplied by `var.fifo_queue = true`) passed in by the module.\"\n  default     = null\n}"
  },
  {
    "path": "terraform-aws-vpc/internet-gateway.tf",
    "content": "resource \"aws_internet_gateway\" \"gw\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  tags = {\r\n    Name = \"internet-gateway-demo\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/nat.tf",
    "content": "resource \"aws_eip\" \"nat\" {\r\n  vpc      = true\r\n}\r\n\r\nresource \"aws_nat_gateway\" \"nat_gw\" {\r\n  allocation_id = \"${aws_eip.nat.id}\"\r\n  subnet_id     = \"${aws_subnet.public_1.id}\"\r\n  depends_on    = [\"aws_internet_gateway.gw\"]\r\n}\r\n\r\nresource \"aws_route_table\" \"route_private\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = \"${aws_nat_gateway.nat_gw.id}\"\r\n  }\r\n\r\n  tags = {\r\n    Name = \"private-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"private_1\" {\r\n  subnet_id      = \"${aws_subnet.private_1.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\nresource \"aws_route_table_association\" \"private_2\" {\r\n  subnet_id      = \"${aws_subnet.private_2.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\nresource \"aws_route_table_association\" \"private_3\" {\r\n  subnet_id      = \"${aws_subnet.private_3.id}\"\r\n  route_table_id = \"${aws_route_table.route_private.id}\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/private_subnets.tf",
    "content": "resource \"aws_subnet\" \"private_1\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.4.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_1-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"private_2\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.5.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_2-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"private_3\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = false\r\n  cidr_block = \"10.0.6.0/24\"\r\n\r\n  tags = {\r\n    Name = \"private_3-demo\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/public_subnets.tf",
    "content": "resource \"aws_subnet\" \"public_1\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.1.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_1-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"public_2\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.2.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_2-demo\"\r\n  }\r\n}\r\nresource \"aws_subnet\" \"public_3\" {\r\n  vpc_id     = aws_vpc.vpc_demo.id\r\n  map_public_ip_on_launch = true\r\n  cidr_block = \"10.0.3.0/24\"\r\n\r\n  tags = {\r\n    Name = \"public_3-demo\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/route_table.tf",
    "content": "resource \"aws_route_table\" \"route-public\" {\r\n  vpc_id = \"${aws_vpc.vpc_demo.id}\"\r\n\r\n  route {\r\n    cidr_block = \"10.0.0.0/0\"\r\n    gateway_id = \"${aws_internet_gateway.gw.id}\"\r\n  }\r\n\r\n  tags = {\r\n    Name = \"public-route-table-demo\"\r\n  }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_1\" {\r\n  subnet_id      = \"${aws_subnet.public_1.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_2\" {\r\n  subnet_id      = \"${aws_subnet.public_2.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n\r\nresource \"aws_route_table_association\" \"public_3\" {\r\n  subnet_id      = \"${aws_subnet.public_3.id}\"\r\n  route_table_id = \"${aws_route_table.route-public.id}\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/variables.tf",
    "content": "variable \"cidr\" {\r\n  description = \"The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden\"\r\n  type        = string\r\n  default     = \"10.0.0.0/16\"\r\n}\r\nvariable \"instance_tenancy\" {\r\n  description = \"A tenancy option for instances launched into the VPC\"\r\n  type        = string\r\n  default     = \"default\"\r\n}\r\n\r\nvariable \"enable_dns_hostnames\" {\r\n  description = \"Should be true to enable DNS hostnames in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_dns_support\" {\r\n  description = \"Should be true to enable DNS support in the VPC\"\r\n  type        = bool\r\n  default     = true\r\n}\r\n\r\nvariable \"enable_classiclink\" {\r\n  description = \"Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic.\"\r\n  type        = bool\r\n  default     = false\r\n}\r\n\r\nvariable \"tags\" {\r\n  description = \"A map of tags to add to all resources\"\r\n  type        = string\r\n  default     = \"Vpc-custom-demo\"\r\n}\r\n"
  },
  {
    "path": "terraform-aws-vpc/vpc.tf",
    "content": "######\r\n# VPC\r\n######\r\n#terraform version >= 12\r\n############\r\nresource \"aws_vpc\" \"vpc_demo\" {\r\n  cidr_block                       = var.cidr\r\n  instance_tenancy                 = var.instance_tenancy\r\n  enable_dns_hostnames             = var.enable_dns_hostnames\r\n  enable_dns_support               = var.enable_dns_support\r\n  enable_classiclink               = var.enable_classiclink\r\n\r\n  tags = {\r\n      Name = var.tags\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "terraform-data-source/.gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "terraform-data-source/README.md",
    "content": "# Terraform-Tutorial\nTerraform Tutorial with all the Live Example\n"
  },
  {
    "path": "terraform-data-source/aws-data-source-example.tf",
    "content": "data \"aws_vpc\" \"selected\" {\r\n\r\n  filter {\r\n    name   = \"tag:Name\"\r\n    values = [\"Default\"]\r\n  }\r\n}\r\n\r\nresource \"aws_subnet\" \"example\" {\r\n  vpc_id            = \"${data.aws_vpc.selected.id}\"\r\n  cidr_block        = \"172.31.0.0/20\"\r\n}\r\n"
  },
  {
    "path": "terraform-data-source/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-data-source/variables.tf",
    "content": "variable \"access_key\" {}\r\nvariable \"secret_key\" {}\r\nvariable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-for-each-example/main.tf",
    "content": "variable \"vpc_id\" {\r\n  description = \"ID for the AWS VPC where a security group is to be created.\"\r\n}\r\n\r\nvariable \"subnet_numbers\" {\r\n  description = \"List of 8-bit numbers of subnets of base_cidr_block that should be granted access.\"\r\n  default = [1, 2, 3, 4, 5, 6]\r\n}\r\n\r\ndata \"aws_vpc\" \"example\" {\r\n  id = var.vpc_id\r\n}\r\n\r\n\r\nresource \"aws_security_group\" \"example\" {\r\n  name        = \"for_each_example\"\r\n  description = \"Allows access from friendly subnets\"\r\n  vpc_id      = var.vpc_id\r\n\r\n  ingress {\r\n    from_port = 0\r\n    to_port   = 0\r\n    protocol  = -1\r\n\r\n    cidr_blocks = [\r\n      for num in var.subnet_numbers:\r\n      cidrsubnet(data.aws_vpc.example.cidr_block, 8, num)\r\n    ]\r\n  }\r\n}"
  },
  {
    "path": "terraform-for-each-example/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"us-east-1\"\r\n}\r\n"
  },
  {
    "path": "terraform-module/main.tf",
    "content": "# Demostration of pass agruments in module using variable\r\nmodule \"module-example\" {\r\n  source = \"github.com/Patelvijaykumar/terraform-aws-instance-template.git\"\r\n\r\n    region                     = \"${var.region}\"\r\n    ami_id                     = \"${var.ami_id}\"\r\n    instance_type              = \"${var.instance_type}\"\r\n    tag                        = \"${var.tag}\"\r\n\r\n}\r\n\r\n# # Demostration of pass agruments in module\r\n# module \"module-example\" {\r\n#   source = \"github.com/Patelvijaykumar/terraform-aws-instance-template.git\"\r\n#\r\n#     region                     = \"us-east-1\"\r\n#     ami_id                     = \"ami-035b3c7efe6d061d5\"\r\n#     instance_type              = \"t2.micro\"\r\n#     tag                        = \"module example\"\r\n#\r\n# }\r\n\r\n\r\n\r\noutput \"instance_public_ip_address\"{\r\n  value=\"${module.module-example.instance_ip}\"\r\n}\r\n"
  },
  {
    "path": "terraform-module/variables.tf",
    "content": "variable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\n\r\nvariable \"ami_id\" {\r\n  default = \"ami-035b3c7efe6d061d5\"\r\n}\r\n\r\nvariable \"instance_type\" {\r\n  default = \"t2.micro\"\r\n}\r\n\r\nvariable \"tag\" {\r\n  default = \"t2.micro\"\r\n}\r\n"
  },
  {
    "path": "terraform-output/.gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "terraform-output/README.md",
    "content": "# Terraform-Tutorial\nTerraform Tutorial with all the Live Example\n"
  },
  {
    "path": "terraform-output/arn.txt",
    "content": "arn:aws:ec2:us-east-1:150843920836:instance/i-0d2877106f7377c0c\n"
  },
  {
    "path": "terraform-output/aws-instance-example.tf",
    "content": "resource \"aws_instance\" \"web-server\" {\r\n  ami           = \"${lookup(var.ami_id, var.region)}\"\r\n  instance_type = \"t2.micro\"\r\n\r\n\r\n  provisioner \"local-exec\" {\r\n    command = \"echo ${aws_instance.web-server.private_ip} >> ip_list.txt\"\r\n  }\r\n\r\n  provisioner \"local-exec\" {\r\n    command = \"echo ${aws_instance.web-server.arn} >> arn.txt\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-output/ip_list.txt",
    "content": "172.31.84.95\n172.31.45.49\n"
  },
  {
    "path": "terraform-output/output.tf",
    "content": "output \"public_ip\" {\r\n  value = \"${aws_instance.web-server.public_ip}\"\r\n}\r\n"
  },
  {
    "path": "terraform-output/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-output/variables.tf",
    "content": "variable \"access_key\" {}\r\nvariable \"secret_key\" {}\r\nvariable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-remote-state/.gitignore",
    "content": "#  Local .terraform directories\n**/.terraform/*\n\n# .tfstate files\n*.tfstate\n*.tfstate.*\n\n# .tfvars files\n*.tfvars\n"
  },
  {
    "path": "terraform-remote-state/README.md",
    "content": "# Terraform-Tutorial\nTerraform Tutorial with all the Live Example\n"
  },
  {
    "path": "terraform-remote-state/aws-remote-state-example.tf",
    "content": "\r\nresource \"aws_s3_bucket\" \"bucket\" {\r\n  bucket = \"my-tf-test-bucket-abc\"\r\n  acl    = \"private\"\r\n\r\n  tags = {\r\n    Name        = \"My bucket\"\r\n    Environment = \"Dev\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-remote-state/backend.tf",
    "content": "terraform {\r\n  required_version = \">= 0.11.0\"\r\n  backend \"s3\" {\r\n    bucket = \"backup-state-terraform\"\r\n    key    = \"terraform/test\"\r\n    region = \"us-east-1\"\r\n    dynamodb_table = \"backend-test\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-remote-state/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-remote-state/variables.tf",
    "content": "variable \"access_key\" {}\r\nvariable \"secret_key\" {}\r\nvariable \"region\" {\r\n  default = \"us-east-1\"\r\n}\r\nvariable \"ami_id\" {\r\n  type = \"map\"\r\n  default = {\r\n    us-east-1    = \"ami-035b3c7efe6d061d5\"\r\n    eu-west-2    = \"ami-132b3c7efe6sdfdsfd\"\r\n    eu-central-1 = \"ami-9787h5h6nsn\"\r\n  }\r\n}\r\n"
  },
  {
    "path": "terraform-variables/provider.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n"
  },
  {
    "path": "terraform-variables/terraform-variable-example.tf",
    "content": "provider \"aws\" {\r\n  region     = \"${var.region}\"\r\n  access_key = \"${var.access_key}\"\r\n  secret_key = \"${var.secret_key}\"\r\n  version    = \"~> 2.0\"\r\n}\r\n\r\nresource \"aws_instance\" \"my_web_server\" {\r\n  ami           = \"${lookup(var.ami_id, var.region)}\"\r\n  instance_type = \"t2.micro\"\r\n}\r\n"
  },
  {
    "path": "terraform-variables/variables.tf",
    "content": "variable \"access_key\" { }\r\nvariable \"secret_key\" { }\r\nvariable \"region\" {\r\ndefault=\"us-east-1\"\r\n}\r\nvariable \"instance_type\" {\r\ndefault=\"t2.micro\"\r\n}\r\n\r\nvariable \"ami_id\" {\r\ntype = \"map\"\r\ndefault = {\r\nus-east-1 = \"ami-035b3c7efe6d061d5\"\r\neu-west-2= \"ami-132b3c7efe6sdfdsfd\"\r\neu-central-1=\"ami-9787h5h6nsn\"\r\n}\r\n}\r\n"
  }
]