@@ -55,13 +55,13 @@ module "verified_access_eni_endpoint" {
55
55
verified_access_group_id = module. verified_access_iam_identity_center . verifiedaccess_group_id
56
56
57
57
description = " user-manager"
58
- application_domain = " user-manger.abc .com"
59
- domain_certificate_arn = " arn:aws: acm:ap-southeast-1:12345678:certificate/a6e8cc16-b740-4e15-8a3a-a3f643589a36 "
58
+ application_domain = " user-manger.my-domain .com"
59
+ domain_certificate_arn = module . acm . acm_certificate_arn
60
60
endpoint_domain_prefix = " user-manger"
61
- security_group_ids = [" sg-090fee8d4dd093 " ]
61
+ security_group_ids = [module . verified_access_sg . security_group_id ]
62
62
63
63
endpoint_type = " network-interface"
64
- network_interface_id = " eni-0ecf3d2c29ad06 "
64
+ network_interface_id = " eni-xys3d2c29ad06 "
65
65
port = 443
66
66
protocol = " https"
67
67
@@ -78,21 +78,103 @@ module "verified_access_elb_endpoint" {
78
78
79
79
description = " student-portal"
80
80
81
- application_domain = " student-portal.abc .com"
82
- domain_certificate_arn = " arn:aws: acm:ap-southeast-1:123789456:certificate/a6e8cc16-b740-4e15-8a3a-a3f643589a36 "
81
+ application_domain = " student-portal.my-domain .com"
82
+ domain_certificate_arn = module . acm . acm_certificate_arn
83
83
endpoint_domain_prefix = " student-portal"
84
- security_group_ids = [" sg-0305d43dd3458dda " ]
84
+ security_group_ids = [module . verified_access_sg . security_group_id ]
85
85
86
86
endpoint_type = " load-balancer"
87
87
load_balancer_arn = " arn:aws:elasticloadbalancing:ap-southeast-1:123456789:loadbalancer/app/student-portal/db28c751e6407a7e"
88
88
port = 443
89
89
protocol = " https"
90
- subnet_ids = [
91
- " subnet-0589f70e50ee83b4" ,
92
- " subnet-080006967a027df"
93
- ]
90
+ subnet_ids = module. vpc . private_subnets
94
91
95
92
tags = {
96
93
Name = " student-portal"
97
94
}
98
95
}
96
+
97
+ module "vpc" {
98
+ source = " terraform-aws-modules/vpc/aws"
99
+ version = " ~> 5.1"
100
+
101
+ name = " test-vpc"
102
+ cidr = " 10.0.0.0/16"
103
+
104
+ azs = [" ap-southeast-1a" , " ap-southeast-1b" , " ap-southeast-1c" ]
105
+ private_subnets = [" 10.0.1.0/24" , " 10.0.2.0/24" , " 10.0.3.0/24" ]
106
+ public_subnets = [" 10.0.101.0/24" , " 10.0.102.0/24" , " 10.0.103.0/24" ]
107
+
108
+ enable_nat_gateway = true
109
+ enable_vpn_gateway = true
110
+
111
+ tags = {
112
+ Terraform = " true"
113
+ Environment = " dev"
114
+ }
115
+ }
116
+
117
+ module "verified_access_sg" {
118
+ source = " terraform-aws-modules/security-group/aws"
119
+ version = " ~> 5.1"
120
+
121
+ name = " verified-access-sg"
122
+ vpc_id = module. vpc . vpc_id
123
+
124
+ ingress_cidr_blocks = [" 0.0.0.0/0" ]
125
+
126
+ ingress_rules = [
127
+ " https-443-tcp"
128
+ ]
129
+
130
+ egress_rules = [" all-all" ]
131
+ }
132
+
133
+ module "acm" {
134
+ source = " terraform-aws-modules/acm/aws"
135
+ version = " ~> 4.0"
136
+
137
+ domain_name = " my-domain.com"
138
+ zone_id = " xyz1234B9AZ6SHAE"
139
+
140
+ validation_method = " DNS"
141
+
142
+ subject_alternative_names = [
143
+ " *.my-domain.com"
144
+ ]
145
+
146
+ wait_for_validation = true
147
+
148
+ tags = {
149
+ Name = " my-domain.com"
150
+ }
151
+ }
152
+
153
+ module "alb" {
154
+ source = " terraform-aws-modules/alb/aws"
155
+ version = " ~> 9.1"
156
+
157
+ name = " my-alb"
158
+ vpc_id = module. vpc . vpc_id
159
+ subnets = module. vpc . private_subnets
160
+ internal = true
161
+
162
+ # Allow traffic from Verified Access security group
163
+ security_groups = [module . verified_access_sg . security_group_id ]
164
+
165
+ listeners = {
166
+ https = {
167
+ port = 443
168
+ protocol = " HTTPS"
169
+ certificate_arn = module.acm.acm_certificate_arn
170
+ forward = {
171
+ target_group_key = " ex-instance"
172
+ }
173
+ }
174
+ }
175
+
176
+ tags = {
177
+ Environment = " Development"
178
+ Project = " Example"
179
+ }
180
+ }
0 commit comments