File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed
infrastructure/stacks/api-layer Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -73,17 +73,21 @@ resource "aws_cloudwatch_event_target" "firehose_target" {
7373 reason = " $.detail.state.reason"
7474 }
7575
76- input_template = jsonencode ({
77- time = " <time>"
78- source = " elid-${ var . environment } :cloudwatch:alarm"
79- sourcetype = " aws:cloudwatch:alarm"
80- event = {
81- alarm_name = " <alarm_name>"
82- new_state = " <new_state>"
83- old_state = " <old_state>"
84- reason = " <reason>"
85- region = " <region>"
86- }
87- })
76+ # Use a heredoc string so EventBridge placeholders like <time> are not JSON-escaped
77+ # (jsonencode would turn < and > into \u003c/\u003e, preventing substitution).
78+ input_template = << TEMPLATE
79+ {
80+ "time": "<time>",
81+ "source": "elid-${ var . environment } :cloudwatch:alarm",
82+ "sourcetype": "aws:cloudwatch:alarm",
83+ "event": {
84+ "alarm_name": "<alarm_name>",
85+ "new_state": "<new_state>",
86+ "old_state": "<old_state>",
87+ "reason": "<reason>",
88+ "region": "<region>"
89+ }
90+ }
91+ TEMPLATE
8892 }
8993}
You can’t perform that action at this time.
0 commit comments