CloudCustodian からの json ファイルを保存するラムダ関数 (cloud-custodian-mailer) があります。これらのファイルは、Slack にメール通知を送信するための Slack テンプレートです。たとえば、タグが欠落している s3 バケットの名前をそのメールで教えてください。
しかし、slack メールでは、すべてのバケットが改行なしで表示されます。「\n」を Json ファイルに追加してから、Lambda 関数を更新しようとしましたが、何もしませんでした。
これは Json ファイルのコードです。
"attachments":[
{
"fallback":"Cloud Custodian Policy Violation",
"title":"S3 Team Tag Audit",
"color":"danger",
"fields":[
{
"title":"Buckets(s) found with absent or empty Team tag",
"value":"{%- for resource in resources -%}
{{ format_resource(resource, policy['resource']) }}
{%- endfor -%}"
},
{
"title":"Account ID",
"value":"{{ account_id }}"
},
{
"title":"Region",
"value":"{{ region }}"
},
{
"title":"Action Description",
"value":"Email notification sent."
}
]
}
],
"channel":"{{ recipient }}",
"username":"Custodian"