|
1 | | -provider "aws" { |
2 | | - region = local.region |
3 | | - |
4 | | - default_tags { |
5 | | - tags = local.default_tags |
6 | | - } |
7 | | -} |
8 | | - |
9 | | -locals { |
10 | | - region = "ap-south-1" |
11 | | - name_prefix = "ex-" |
12 | | - |
13 | | - # VPC |
14 | | - vpc_cidr = "10.0.0.0/16" |
15 | | - vpc_azs = ["ap-south-1a", "ap-south-1b"] |
16 | | - vpc_private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] |
17 | | - vpc_public_subnets = ["10.0.11.0/24", "10.0.12.0/24"] |
18 | | - |
19 | | - # ECS Cluster |
20 | | - cluster_name = "${local.name_prefix}my-cluster" |
21 | | - |
22 | | - default_tags = { |
23 | | - Environment = "Dev" |
24 | | - ManagedBy = "Terraform" |
25 | | - } |
26 | | -} |
27 | | - |
28 | | -################################################################################ |
29 | | -# ECS Module |
30 | | -################################################################################ |
31 | | - |
32 | 1 | module "ecs" { |
33 | 2 | source = "../../" |
34 | 3 |
|
35 | | - cluster_name = local.cluster_name |
36 | | - |
37 | | - setting = [ |
38 | | - { |
39 | | - name = "containerInsights" |
40 | | - value = "enabled" |
41 | | - } |
42 | | - ] |
43 | | -} |
44 | | - |
45 | | -################################################################################ |
46 | | -# Supporting Resources |
47 | | -################################################################################ |
48 | | - |
49 | | -module "vpc" { |
50 | | - source = "terraform-aws-modules/vpc/aws" |
51 | | - version = "~> 5.9.0" |
52 | | - |
53 | | - name = "${local.name_prefix}my-vpc" |
54 | | - cidr = local.vpc_cidr |
55 | | - |
56 | | - azs = local.vpc_azs |
57 | | - private_subnets = local.vpc_private_subnets |
58 | | - public_subnets = local.vpc_public_subnets |
59 | | - |
60 | | - enable_nat_gateway = true |
61 | | - enable_vpn_gateway = false |
| 4 | + cluster_name = local.cluster_name |
| 5 | + cluster_setting = local.cluster_setting |
| 6 | + cluster_tags = local.cluster_tags |
| 7 | + |
| 8 | + # ASG Variables |
| 9 | + asg_name = local.asg_name |
| 10 | + asg_vpc_zone_identifier = local.asg_vpc_zone_identifier |
| 11 | + asg_desired_capacity = local.asg_desired_capacity |
| 12 | + asg_min_size = local.asg_min_size |
| 13 | + asg_max_size = local.asg_max_size |
| 14 | + asg_instances_tags = local.asg_instances_tags |
| 15 | + asg_tags = local.asg_tags |
| 16 | + |
| 17 | + # Launch Template |
| 18 | + asg_create_launch_template = local.asg_create_launch_template |
| 19 | + asg_launch_template = local.asg_launch_template |
| 20 | + |
| 21 | + # IAM Role |
| 22 | + asg_iam_role_name = local.asg_iam_role_name |
| 23 | + asg_iam_role_tags = local.asg_iam_role_tags |
| 24 | + |
| 25 | + # IAM Instance Profile |
| 26 | + asg_iam_instance_profile_name = local.asg_iam_instance_profile_name |
| 27 | + asg_iam_instance_profile_tags = local.asg_iam_instance_profile_tags |
62 | 28 | } |
0 commit comments