AWS Terraform Project

Job ID: 34217865

Budget: $30 – $250 USD

I need Terraform code to create the following resources. The code should be setup in the following hierarchy (for example):

terraform-repo/
├─ environments/
│ ├─ dev/
│ │ ├─ main.tf
│ │ ├─ provider.tf
│ ├─ prod/
│ │ ├─ main.tf
│ │ ├─ provider.tf
├─ modules/
│ ├─ route53/
│ │ ├─ outputs.tf
│ │ ├─ provider.tf
│ │ ├─ records.tf
│ │ ├─ variables.tf
│ ├─ VPC/
│ │ ├─ vpc.tf
│ │ ├─ outputs.tf
│ │ ├─ provider.tf
│ │ ├─ variables.tf
├─ provider.tf

REGION - us-west-2

VPC
- Name - test-vpc
- IPv4 CIDR - 10.0.0.1/21
- 3 AZ's - us-west-2a, us-west-2b, us-west-2c
- public subnets - 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24
- private subnets - 10.0.3.0/24, 10.0.4.0/24, 10.0.5.0/24
- database subnets - 10.0.6.0/24, 10.0.7.0/24, 10.0.8.0/24
- IGW
- NAT Gateway
- Route tables

Route53
- Create domain test.com
- Add "A" record

ECS/Fargate
- Name - test-ecs-app
- ECS Cluster
- ALB
- Target groups
- Auto scaling
- Service
- Task
- 2 containers - 1 spot instance
- Docker container - Docker compose - you can use any container (Nginx)
- Subnets - private - us-west-2a, us-west-2b, us-west-2c
- Security group allow port 80
- Add test-ecs-app.test.com to Route53

RDS
- Name - test-rds-database
- Database creation - PostgreSQL
- Security groups
- Publically accessible - no
- Size t2.micro (smallest)
- Performance insights enabled
- Customer KMS key
- Cloudwatch logs enabled
- Backups enabled - 30 days retention

WAF
- Name test-waf
- Assign to ECS ALB
- Cloudwatch logs enabled
- AWSManagedRulesKnownBadInputsRule
- AWSManagedRulesCommonRule
- AWSManagedRulesSQLiRule
- AWSManagedRulesAmazonIpReputation
- AWSManagedRulesLinuxRule
- Custom white list rule group

Lambda
- Name test-lambda
- Hello World Node.js code
- 256 Memory
- 60 seconds timeout
- Trigger API Gateway
- Execution Role with Cloudwatch access
- Envronment variable - key "configRegion" value - "prod-us-west-2"
- Tags - key "Name" value "test lambda"
- Subnets - private - us-west-2a, us-west-2b, us-west-2c
- Security group
- Logs and metrics enabled

API Gateway
- Name test-api
- Resources any
- Stages - dev
- API gateway points to "test-lambda" lambda
- Custom domain name - test-api-gateway.test.com

Elasticache - Redis
- Name test-redis-cluster
- Redis cluster
- cache.t2.micro
- Cluster mode on
- Number of nodes 2
- test-vpc VPC ID
- Security group
- Slow logs enabled

Codebuild
- Name test-codebuild
- 2 Environment name variables - ENVIRONMENT and RELEASE
- Slack notification rule

Cloudformation
- Name test-cloudformation-stack
- Example cloudformation stack

Cloudwatch
- Name test-cloudwatch-group
- Log group
- Dashboard
- Example alert

S3 Bucket
- Name test-s3-bucket
- Block all public access
- Default encryption enabled - Amazon S3-managed keys (SSE-S3)
Related categories: Amazon Web Services Terraform