Skip to content

Commit 2f45db7

Browse files
committed
Minor fixes in rendered output
1 parent ceb9ef6 commit 2f45db7

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/modulestf/convert.py

+24-3
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ def convert_graph_to_modulestf_config(graph): # noqa: C901
423423
"read_capacity": node.get("readUnits"),
424424
"write_capacity": node.get("writeUnits"),
425425
"billing_mode": "PROVISIONED" if node.get("capacityMode") == "provisioned" else "PAY_PER_REQUEST",
426+
"hash_key": "id",
427+
"attributes": [{
428+
"name": "id",
429+
"type": "N"
430+
}]
426431
})
427432

428433
resources.append(r.content())
@@ -431,7 +436,7 @@ def convert_graph_to_modulestf_config(graph): # noqa: C901
431436
r = Resource(key, "s3-bucket", node_text)
432437

433438
r.update_params({
434-
"bucket": node_text if node_text else random_pet(),
439+
"bucket": node_text.lower() if node_text else random_pet(),
435440
"region": node.get("region", ""),
436441
})
437442

@@ -441,7 +446,22 @@ def convert_graph_to_modulestf_config(graph): # noqa: C901
441446
r = Resource(key, "cloudfront", node_text)
442447

443448
r.update_params({
444-
"wait_for_deployment": False
449+
"wait_for_deployment": False,
450+
"origin": "{ \
451+
\"default\": { \
452+
\"domain_name\": \"website.example.com\", \
453+
\"custom_origin_config\": { \
454+
\"http_port\": 80, \
455+
\"https_port\": 443, \
456+
\"origin_protocol_policy\": \"match-viewer\", \
457+
\"origin_ssl_protocols\": [\"TLSv1\"], \
458+
} \
459+
} \
460+
}",
461+
"default_cache_behavior": "{ \
462+
\"target_origin_id\": \"default\", \
463+
\"viewer_protocol_policy\": \"allow-all\", \
464+
}"
445465
})
446466

447467
resources.append(r.content())
@@ -454,7 +474,7 @@ def convert_graph_to_modulestf_config(graph): # noqa: C901
454474
"function_name": node_text if node_text else random_pet(),
455475
"handler": "handler.lambda_handler",
456476
"runtime": "python3.8",
457-
"source_path": "\"handler.py\"" # @todo: create this file also
477+
"source_path": "jsonencode(\"handler.py\")"
458478
})
459479

460480
resources.append(r.content())
@@ -465,6 +485,7 @@ def convert_graph_to_modulestf_config(graph): # noqa: C901
465485
r.update_params({
466486
"name": node_text if node_text else random_pet(),
467487
"protocol_type": "WEBSOCKET" if node.get("apiType") == "websocket" else "HTTP",
488+
"create_api_domain_name": False
468489
})
469490

470491
resources.append(r.content())

terraform/main.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ module "alarm_lambda_with_errors" {
193193
alarm_description = "Lambda with errors"
194194
comparison_operator = "GreaterThanOrEqualToThreshold"
195195
evaluation_periods = 1
196-
threshold = 1
196+
threshold = 5
197197
period = 60
198198
unit = "Count"
199199
treat_missing_data = "notBreaching"
@@ -217,8 +217,8 @@ module "alarm_lambda_is_slow" {
217217
alarm_name = "lambda-slow-${module.lambda.lambda_function_name}"
218218
alarm_description = "Lambda is too high"
219219
comparison_operator = "GreaterThanOrEqualToThreshold"
220-
evaluation_periods = 1
221-
threshold = 20000
220+
evaluation_periods = 2
221+
threshold = 29000
222222
period = 60
223223
unit = "Milliseconds"
224224
treat_missing_data = "notBreaching"
@@ -243,7 +243,7 @@ module "alarm_lambda_is_popular" {
243243
alarm_description = "Lambda is too popular"
244244
comparison_operator = "GreaterThanOrEqualToThreshold"
245245
evaluation_periods = 1
246-
threshold = 20
246+
threshold = 50
247247
period = 60
248248
unit = "Count"
249249
treat_missing_data = "notBreaching"

0 commit comments

Comments
 (0)