@@ -2,10 +2,385 @@ locals {
22 include_scenarios = true
33}
44
5- module "scenarios" {
5+ # Moved blocks to handle module restructuring without recreating resources
6+ # VPC module moved from scenarios to baseline
7+ moved {
8+ from = module. scenarios [0 ]. module . vpc
9+ to = module. baseline . module . vpc
10+ }
11+
12+ # AMI data source moved from scenarios to baseline
13+ moved {
14+ from = module. scenarios [0 ]. data . aws_ami . amazon_linux
15+ to = module. baseline . data . aws_ami . amazon_linux
16+ }
17+
18+ # Memory optimization module moved from scenarios to heritage
19+ moved {
20+ from = module. scenarios [0 ]. module . memory_optimization
21+ to = module. heritage [0 ]. module . memory_optimization
22+ }
23+
24+ # Message size breach module moved from scenarios to heritage
25+ moved {
26+ from = module. scenarios [0 ]. module . message_size_breach [0 ]
27+ to = module. heritage [0 ]. module . message_size_breach [0 ]
28+ }
29+
30+ # All other resources in scenarios module moved to heritage module
31+ # CloudFront module
32+ moved {
33+ from = module. scenarios [0 ]. module . cloudfront
34+ to = module. heritage [0 ]. module . cloudfront
35+ }
36+
37+ # S3 module
38+ moved {
39+ from = module. scenarios [0 ]. module . s3_one
40+ to = module. heritage [0 ]. module . s3_one
41+ }
42+
43+ # ECS module
44+ moved {
45+ from = module. scenarios [0 ]. module . ecs
46+ to = module. heritage [0 ]. module . ecs
47+ }
48+
49+ # All other resources (loom.tf, s3_bucket_notification.tf, sns_lambda.tf, asg_change.tf, manual_sg.tf)
50+ # These are individual resources, so we need to move them individually
51+ # S3 bucket notification resources
52+ moved {
53+ from = module. scenarios [0 ]. aws_s3_bucket . my_bucket
54+ to = module. heritage [0 ]. aws_s3_bucket . my_bucket
55+ }
56+
57+ moved {
58+ from = module. scenarios [0 ]. aws_sqs_queue . my_queue
59+ to = module. heritage [0 ]. aws_sqs_queue . my_queue
60+ }
61+
62+ moved {
63+ from = module. scenarios [0 ]. aws_s3_bucket_notification . bucket_notification
64+ to = module. heritage [0 ]. aws_s3_bucket_notification . bucket_notification
65+ }
66+
67+ moved {
68+ from = module. scenarios [0 ]. aws_sqs_queue_policy . my_queue_policy
69+ to = module. heritage [0 ]. aws_sqs_queue_policy . my_queue_policy
70+ }
71+
72+ # SNS/Lambda resources
73+ moved {
74+ from = module. scenarios [0 ]. data . archive_file . lambda_zip
75+ to = module. heritage [0 ]. data . archive_file . lambda_zip
76+ }
77+
78+ moved {
79+ from = module. scenarios [0 ]. aws_iam_role . lambda_iam_role
80+ to = module. heritage [0 ]. aws_iam_role . lambda_iam_role
81+ }
82+
83+ moved {
84+ from = module. scenarios [0 ]. aws_lambda_function . example
85+ to = module. heritage [0 ]. aws_lambda_function . example
86+ }
87+
88+ moved {
89+ from = module. scenarios [0 ]. aws_sns_topic . example_topic
90+ to = module. heritage [0 ]. aws_sns_topic . example_topic
91+ }
92+
93+ # ASG resources
94+ moved {
95+ from = module. scenarios [0 ]. aws_launch_template . my_launch_template
96+ to = module. heritage [0 ]. aws_launch_template . my_launch_template
97+ }
98+
99+ moved {
100+ from = module. scenarios [0 ]. aws_lb_target_group . my_target_group
101+ to = module. heritage [0 ]. aws_lb_target_group . my_target_group
102+ }
103+
104+ moved {
105+ from = module. scenarios [0 ]. aws_lb_target_group . my_new_target_group
106+ to = module. heritage [0 ]. aws_lb_target_group . my_new_target_group
107+ }
108+
109+ moved {
110+ from = module. scenarios [0 ]. aws_autoscaling_group . my_asg
111+ to = module. heritage [0 ]. aws_autoscaling_group . my_asg
112+ }
113+
114+ # Manual SG resources
115+ moved {
116+ from = module. scenarios [0 ]. aws_security_group . allow_access
117+ to = module. heritage [0 ]. aws_security_group . allow_access
118+ }
119+
120+ moved {
121+ from = module. scenarios [0 ]. aws_subnet . restricted-2a
122+ to = module. heritage [0 ]. aws_subnet . restricted-2a
123+ }
124+
125+ moved {
126+ from = module. scenarios [0 ]. aws_subnet . restricted-2b
127+ to = module. heritage [0 ]. aws_subnet . restricted-2b
128+ }
129+
130+ moved {
131+ from = module. scenarios [0 ]. aws_route_table_association . restricted-2a
132+ to = module. heritage [0 ]. aws_route_table_association . restricted-2a
133+ }
134+
135+ moved {
136+ from = module. scenarios [0 ]. aws_route_table_association . restricted-2b
137+ to = module. heritage [0 ]. aws_route_table_association . restricted-2b
138+ }
139+
140+ moved {
141+ from = module. scenarios [0 ]. aws_network_acl . restricted
142+ to = module. heritage [0 ]. aws_network_acl . restricted
143+ }
144+
145+ moved {
146+ from = module. scenarios [0 ]. aws_network_acl_rule . allow_http
147+ to = module. heritage [0 ]. aws_network_acl_rule . allow_http
148+ }
149+
150+ moved {
151+ from = module. scenarios [0 ]. aws_network_acl_rule . allow_ssh
152+ to = module. heritage [0 ]. aws_network_acl_rule . allow_ssh
153+ }
154+
155+ moved {
156+ from = module. scenarios [0 ]. aws_network_acl_rule . allow_ephemeral
157+ to = module. heritage [0 ]. aws_network_acl_rule . allow_ephemeral
158+ }
159+
160+ moved {
161+ from = module. scenarios [0 ]. aws_network_acl_rule . deny_high_ports
162+ to = module. heritage [0 ]. aws_network_acl_rule . deny_high_ports
163+ }
164+
165+ moved {
166+ from = module. scenarios [0 ]. aws_network_acl_rule . allow_outbound
167+ to = module. heritage [0 ]. aws_network_acl_rule . allow_outbound
168+ }
169+
170+ moved {
171+ from = module. scenarios [0 ]. aws_instance . webserver
172+ to = module. heritage [0 ]. aws_instance . webserver
173+ }
174+
175+ moved {
176+ from = module. scenarios [0 ]. aws_instance . app_server
177+ to = module. heritage [0 ]. aws_instance . app_server
178+ }
179+
180+ moved {
181+ from = module. scenarios [0 ]. aws_security_group . instance_sg
182+ to = module. heritage [0 ]. aws_security_group . instance_sg
183+ }
184+
185+ # Loom resources (CloudFront, S3, ECS, RDS, etc.)
186+ # Data sources
187+ moved {
188+ from = module. scenarios [0 ]. data . aws_canonical_user_id . current
189+ to = module. heritage [0 ]. data . aws_canonical_user_id . current
190+ }
191+
192+ moved {
193+ from = module. scenarios [0 ]. data . aws_cloudfront_log_delivery_canonical_user_id . cloudfront
194+ to = module. heritage [0 ]. data . aws_cloudfront_log_delivery_canonical_user_id . cloudfront
195+ }
196+
197+ moved {
198+ from = module. scenarios [0 ]. data . aws_iam_policy_document . s3_policy
199+ to = module. heritage [0 ]. data . aws_iam_policy_document . s3_policy
200+ }
201+
202+ moved {
203+ from = module. scenarios [0 ]. data . aws_route53_zone . demo
204+ to = module. heritage [0 ]. data . aws_route53_zone . demo
205+ }
206+
207+ moved {
208+ from = module. scenarios [0 ]. data . aws_ssm_parameter . amzn2_latest
209+ to = module. heritage [0 ]. data . aws_ssm_parameter . amzn2_latest
210+ }
211+
212+ moved {
213+ from = module. scenarios [0 ]. random_pet . this
214+ to = module. heritage [0 ]. random_pet . this
215+ }
216+
217+ moved {
218+ from = module. scenarios [0 ]. random_pet . second
219+ to = module. heritage [0 ]. random_pet . second
220+ }
221+
222+ moved {
223+ from = module. scenarios [0 ]. aws_cloudfront_function . example
224+ to = module. heritage [0 ]. aws_cloudfront_function . example
225+ }
226+
227+ moved {
228+ from = module. scenarios [0 ]. aws_s3_bucket . b
229+ to = module. heritage [0 ]. aws_s3_bucket . b
230+ }
231+
232+ moved {
233+ from = module. scenarios [0 ]. aws_s3_bucket_ownership_controls . b
234+ to = module. heritage [0 ]. aws_s3_bucket_ownership_controls . b
235+ }
236+
237+ moved {
238+ from = module. scenarios [0 ]. aws_s3_bucket_acl . b_acl
239+ to = module. heritage [0 ]. aws_s3_bucket_acl . b_acl
240+ }
241+
242+ moved {
243+ from = module. scenarios [0 ]. aws_cloudfront_origin_access_control . b
244+ to = module. heritage [0 ]. aws_cloudfront_origin_access_control . b
245+ }
246+
247+ moved {
248+ from = module. scenarios [0 ]. aws_cloudfront_distribution . s3_distribution
249+ to = module. heritage [0 ]. aws_cloudfront_distribution . s3_distribution
250+ }
251+
252+ moved {
253+ from = module. scenarios [0 ]. aws_cloudfront_response_headers_policy . headers-policy
254+ to = module. heritage [0 ]. aws_cloudfront_response_headers_policy . headers-policy
255+ }
256+
257+ moved {
258+ from = module. scenarios [0 ]. aws_cloudfront_cache_policy . headers_based_policy
259+ to = module. heritage [0 ]. aws_cloudfront_cache_policy . headers_based_policy
260+ }
261+
262+ moved {
263+ from = module. scenarios [0 ]. aws_cloudfront_origin_request_policy . headers_based_policy
264+ to = module. heritage [0 ]. aws_cloudfront_origin_request_policy . headers_based_policy
265+ }
266+
267+ moved {
268+ from = module. scenarios [0 ]. aws_s3_bucket_policy . bucket_policy
269+ to = module. heritage [0 ]. aws_s3_bucket_policy . bucket_policy
270+ }
271+
272+ moved {
273+ from = module. scenarios [0 ]. aws_lb . main
274+ to = module. heritage [0 ]. aws_lb . main
275+ }
276+
277+ moved {
278+ from = module. scenarios [0 ]. aws_lb_listener . http
279+ to = module. heritage [0 ]. aws_lb_listener . http
280+ }
281+
282+ moved {
283+ from = module. scenarios [0 ]. aws_db_subnet_group . default
284+ to = module. heritage [0 ]. aws_db_subnet_group . default
285+ }
286+
287+ moved {
288+ from = module. scenarios [0 ]. aws_rds_cluster . face_database
289+ to = module. heritage [0 ]. aws_rds_cluster . face_database
290+ }
291+
292+ moved {
293+ from = module. scenarios [0 ]. aws_rds_cluster_instance . face_database
294+ to = module. heritage [0 ]. aws_rds_cluster_instance . face_database
295+ }
296+
297+ moved {
298+ from = module. scenarios [0 ]. aws_ecs_task_definition . face
299+ to = module. heritage [0 ]. aws_ecs_task_definition . face
300+ }
301+
302+ moved {
303+ from = module. scenarios [0 ]. aws_ecs_service . face
304+ to = module. heritage [0 ]. aws_ecs_service . face
305+ }
306+
307+ moved {
308+ from = module. scenarios [0 ]. aws_lb_listener_rule . face
309+ to = module. heritage [0 ]. aws_lb_listener_rule . face
310+ }
311+
312+ moved {
313+ from = module. scenarios [0 ]. aws_lb_target_group . face
314+ to = module. heritage [0 ]. aws_lb_target_group . face
315+ }
316+
317+ moved {
318+ from = module. scenarios [0 ]. aws_route53_record . face
319+ to = module. heritage [0 ]. aws_route53_record . face
320+ }
321+
322+ moved {
323+ from = module. scenarios [0 ]. aws_ecs_task_definition . visit_counter
324+ to = module. heritage [0 ]. aws_ecs_task_definition . visit_counter
325+ }
326+
327+ moved {
328+ from = module. scenarios [0 ]. aws_ecs_service . visit_counter
329+ to = module. heritage [0 ]. aws_ecs_service . visit_counter
330+ }
331+
332+ moved {
333+ from = module. scenarios [0 ]. aws_lb_listener_rule . visit_counter
334+ to = module. heritage [0 ]. aws_lb_listener_rule . visit_counter
335+ }
336+
337+ moved {
338+ from = module. scenarios [0 ]. aws_lb_target_group . visit_counter
339+ to = module. heritage [0 ]. aws_lb_target_group . visit_counter
340+ }
341+
342+ moved {
343+ from = module. scenarios [0 ]. aws_route53_record . visit_counter
344+ to = module. heritage [0 ]. aws_route53_record . visit_counter
345+ }
346+
347+ moved {
348+ from = module. scenarios [0 ]. aws_cloudfront_distribution . visit_counter
349+ to = module. heritage [0 ]. aws_cloudfront_distribution . visit_counter
350+ }
351+
352+ module "baseline" {
353+ source = " ./modules/baseline"
354+
355+ example_env = var. example_env
356+ }
357+
358+ module "heritage" {
6359 count = local. include_scenarios ? 1 : 0
7360
8- source = " ./modules/scenarios "
361+ source = " ./modules/heritage "
9362
10363 example_env = var. example_env
364+
365+ # VPC inputs from baseline
366+ vpc_id = module. baseline . vpc_id
367+ public_subnets = module. baseline . public_subnets
368+ private_subnets = module. baseline . private_subnets
369+ default_security_group_id = module. baseline . default_security_group_id
370+ public_route_table_ids = module. baseline . public_route_table_ids
371+ ami_id = module. baseline . ami_id
372+
373+ # Memory optimization demo settings
374+ enable_memory_optimization_demo = var. enable_memory_optimization_demo
375+ memory_optimization_container_memory = var. memory_optimization_container_memory
376+ memory_optimization_container_count = var. memory_optimization_container_count
377+ days_until_black_friday = var. days_until_black_friday
378+
379+ # Message size breach demo settings
380+ enable_message_size_breach_demo = var. enable_message_size_breach_demo
381+ message_size_breach_max_size = var. message_size_breach_max_size
382+ message_size_breach_batch_size = var. message_size_breach_batch_size
383+ message_size_breach_lambda_timeout = var. message_size_breach_lambda_timeout
384+ message_size_breach_lambda_memory = var. message_size_breach_lambda_memory
385+ message_size_breach_retention_days = var. message_size_breach_retention_days
11386}
0 commit comments