File tree Expand file tree Collapse file tree 12 files changed +600
-14
lines changed Expand file tree Collapse file tree 12 files changed +600
-14
lines changed Original file line number Diff line number Diff line change 1+ resource  "aws_lb_target_group"  "auth_manager_private_tg"  {
2+   # ts:skip=AC_AWS_0492
3+   name         =  " auth-manager-private" 
4+   port         =  8000 
5+   protocol     =  " HTTP" 
6+   target_type  =  " ip" 
7+   vpc_id       =  . vpc_id 
8+ 
9+   lifecycle  {
10+     create_before_destroy  =  true 
11+   }
12+ 
13+   health_check  {
14+     enabled   =  true 
15+     path      =  " ${ var . root_path } /health" 
16+     protocol  =  " HTTP" 
17+   }
18+ 
19+   tags  =  . auth_manager_svc_tags 
20+ }
21+ 
22+ resource  "aws_lb_listener_rule"  "auth_manager_private_listener_rule"  {
23+   listener_arn  =  . private_alb_listener_arn 
24+   priority      =  610 
25+ 
26+   action  {
27+     type              =  " forward" 
28+     target_group_arn  =  . auth_manager_private_tg . arn 
29+   }
30+ 
31+   condition  {
32+     path_pattern  {
33+       values  =  " ${ var . root_path } *" 
34+     }
35+   }
36+ 
37+   condition  {
38+     source_ip  {
39+       values  =  . allowed_source_ip_cidr_blocks 
40+     }
41+   }
42+   tags  =  . auth_manager_svc_tags 
43+ }
Original file line number Diff line number Diff line change 1+ locals  {
2+   clustername  =  " auth_manager_ecs_cluster" 
3+   servicename  =  " auth_manager_ecs_service" 
4+ }
5+ 
6+ resource  "aws_cloudwatch_dashboard"  "main"  {
7+   dashboard_name  =  " auth_manager" 
8+ 
9+   dashboard_body  =  jsonencode ({
10+     widgets =  [
11+       {
12+         type   =  " metric" 
13+         x      =  0 
14+         y      =  0 
15+         width  =  12 
16+         height =  6 
17+ 
18+         properties =  {
19+           metrics =  [
20+             [" AWS/ECS" 
21+               " CPUUtilization" 
22+               " ClusterName" 
23+               " ServiceName" 
24+               { " stat" :  " Average" 
25+             " region" :  var.aws_region }]
26+           ]
27+           view    =  " timeSeries" 
28+           stacked =  false 
29+           region  =  var.aws_region
30+           title   =  " CPUUtilization: Average" 
31+           period  =  300 
32+         }
33+       },
34+       {
35+         type   =  " metric" 
36+         x      =  12 
37+         y      =  0 
38+         width  =  12 
39+         height =  6 
40+ 
41+         properties =  {
42+           metrics =  [
43+             [" AWS/ECS" 
44+               " MemoryUtilization" 
45+               " ClusterName" 
46+               " ServiceName" 
47+             { " stat" :  " Average" " region" :  var.aws_region }]
48+           ]
49+           view    =  " timeSeries" 
50+           stacked =  false 
51+           region  =  var.aws_region
52+           title   =  " MemoryUtilization: Average" 
53+           period  =  300 
54+         }
55+       }
56+     ]
57+   })
58+ }
Original file line number Diff line number Diff line change 11resource  "aws_db_subnet_group"  "auth_manager_db_cluster_subnet_group"  {
22  name        =  " auth-manager-db-cluster-group" 
33  subnet_ids  =  aws_subnet . auth_manager_db_a . id , aws_subnet . auth_manager_db_b . id ]
4+ 
5+   tags  =  . auth_manager_svc_tags 
46}
57
68data  "aws_secretsmanager_secret_version"  "auth_manager_database_password"  {
Original file line number Diff line number Diff line change 1+ output  "private_lb_rule_suffix"  {
2+   description  =  " auth manager Private Loadbalancer Rule Suffix" 
3+   value        =  . auth_manager_private_tg . arn_suffix 
4+ }
Original file line number Diff line number Diff line change 1+ resource  "aws_iam_policy"  "auth_manager_secrets_access"  {
2+   name         =  " auth_manager-secrets-access-policy" 
3+   description  =  " Policy that gives access to the auth_manager service secrets" 
4+ 
5+   policy  =  <<- EOT 
6+   { 
7+     "Version": "2012-10-17", 
8+     "Statement": [ 
9+       { 
10+         "Effect": "Allow", 
11+         "Action": [ 
12+           "ssm:GetParameters", 
13+           "secretsmanager:GetSecretValue" 
14+         ], 
15+         "Resource": [ 
16+           "${ var . auth_manager_secrets_arn } " 
17+         ] 
18+       } 
19+     ] 
20+   } 
21+   EOT 
22+ }
23+ 
24+ 
Original file line number Diff line number Diff line change 1+ resource  "aws_security_group"  "auth_manager_sg"  {
2+   vpc_id  =  . vpc_id 
3+ 
4+   name         =  " main_auth_manager_sg" 
5+   description  =  " main security group for auth manager database" 
6+ 
7+   ingress  {
8+     description  =  " Allow Postgres access from the VPC" 
9+     from_port    =  5432 
10+     to_port      =  5432 
11+     protocol     =  " tcp" 
12+     cidr_blocks  =  . allowed_source_ip_cidr_blocks 
13+   }
14+ 
15+   tags  =  . auth_manager_svc_tags 
16+ }
17+ 
18+ resource  "aws_vpc_security_group_ingress_rule"  "main_subnet_ingress"  {
19+   security_group_id  =  . acc_sg . id 
20+   description        =  " Allow everything incoming from the VPC" 
21+   ip_protocol        =  - 1 
22+   cidr_ipv4          =  . aws_vpc . main . cidr_block 
23+   from_port          =  - 1 
24+   to_port            =  - 1 
25+ }
26+ 
27+ resource  "aws_vpc_security_group_egress_rule"  "main_subnet_egress"  {
28+   security_group_id  =  . acc_sg . id 
29+   description        =  " Allow everything outgoing" 
30+   ip_protocol        =  - 1 
31+   cidr_ipv4          =  " 0.0.0.0/0" 
32+   from_port          =  - 1 
33+   to_port            =  - 1 
34+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments