Skip to content

Commit 3fef563

Browse files
author
Duleendra
committed
[PFMENG-1278] Update the examples
1 parent 81f4c5c commit 3fef563

File tree

1 file changed

+93
-11
lines changed

1 file changed

+93
-11
lines changed

examples/main.tf

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ module "verified_access_eni_endpoint" {
5555
verified_access_group_id = module.verified_access_iam_identity_center.verifiedaccess_group_id
5656

5757
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
6060
endpoint_domain_prefix = "user-manger"
61-
security_group_ids = ["sg-090fee8d4dd093"]
61+
security_group_ids = [module.verified_access_sg.security_group_id]
6262

6363
endpoint_type = "network-interface"
64-
network_interface_id = "eni-0ecf3d2c29ad06"
64+
network_interface_id = "eni-xys3d2c29ad06"
6565
port = 443
6666
protocol = "https"
6767

@@ -78,21 +78,103 @@ module "verified_access_elb_endpoint" {
7878

7979
description = "student-portal"
8080

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
8383
endpoint_domain_prefix = "student-portal"
84-
security_group_ids = ["sg-0305d43dd3458dda"]
84+
security_group_ids = [module.verified_access_sg.security_group_id]
8585

8686
endpoint_type = "load-balancer"
8787
load_balancer_arn = "arn:aws:elasticloadbalancing:ap-southeast-1:123456789:loadbalancer/app/student-portal/db28c751e6407a7e"
8888
port = 443
8989
protocol = "https"
90-
subnet_ids = [
91-
"subnet-0589f70e50ee83b4",
92-
"subnet-080006967a027df"
93-
]
90+
subnet_ids = module.vpc.private_subnets
9491

9592
tags = {
9693
Name = "student-portal"
9794
}
9895
}
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

Comments
 (0)