Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Jun 25, 2024
1 parent ddb060a commit 2feea5b
Show file tree
Hide file tree
Showing 3 changed files with 1,426 additions and 1,367 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

## Version History

### v1.11.0

- :rocket: Avoid publishing empty batch messages

### v1.10.0

- :rocket: Ignore ENI resources in the Required Tags rule as AWS currently doesn't propagate ALB tags to ENIs, resulting in significant alarm fatigue
Expand Down
38 changes: 21 additions & 17 deletions index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,28 @@ async function handler() {
console.log(`ok - ${rule.ConfigRuleName}: ${res.EvaluationResults.length} violations`);
if (res.EvaluationResults.length) {
try {
await sns.send(new SNS.PublishBatchCommand({
TopicArn: process.env.TopicArn,
PublishBatchRequestEntries: res.EvaluationResults.map((e) => {
const f = e.EvaluationResultIdentifier.EvaluationResultQualifier;
return {
Id: f.ResourceId.split(':').pop().replace(/[^a-zA-Z0-9]/g, '-'),
Subject: `ALARM: \"${f.ConfigRuleName}:${f.ResourceId}\" - Account: ${process.env.AWS_ACCOUNT_ID}`,
Message: `A Resource (${f.ResourceType}) with ARN ${f.ResourceId} is violating the ${f.ConfigRuleName} rule`
};
}).filter((e) => {
if (rule.ConfigRuleName === 'Required-Tags') {
// TODO: Remove once Cloudformation created LoadBalancers propagate tags from ALB => ENI
return !e.Subject.includes('Required-Tags:eni-')
}
const PublishBatchRequestEntries = res.EvaluationResults.map((e) => {
const f = e.EvaluationResultIdentifier.EvaluationResultQualifier;
return {
Id: f.ResourceId.split(':').pop().replace(/[^a-zA-Z0-9]/g, '-'),
Subject: `ALARM: \"${f.ConfigRuleName}:${f.ResourceId}\" - Account: ${process.env.AWS_ACCOUNT_ID}`,
Message: `A Resource (${f.ResourceType}) with ARN ${f.ResourceId} is violating the ${f.ConfigRuleName} rule`
};
}).filter((e) => {
if (rule.ConfigRuleName === 'Required-Tags') {
// TODO: Remove once Cloudformation created LoadBalancers propagate tags from ALB => ENI
return !e.Subject.includes('Required-Tags:eni-')
}

return true;
})
}));
return true;
});

if (PublishBatchRequestEntries.length) {
await sns.send(new SNS.PublishBatchCommand({
TopicArn: process.env.TopicArn,
PublishBatchRequestEntries
}));
}
} catch (err) {
console.error(err);
errs.push(err);
Expand Down
Loading

0 comments on commit 2feea5b

Please sign in to comment.