Skip to content

Commit 2b80ec7

Browse files
authored
Do not evaluate IAM resources with status ResourceNotRecorded and Res… (#1065)
* Do not evaluate IAM resources with status ResourceNotRecorded and ResourceDeleteNotRecorded * Generate new zip file for ec2-instance-profile-permissions lambda
1 parent b3be107 commit 2b80ec7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Binary file not shown.

reference-artifacts/config-rules/src/ec2-instance-profile-permissions/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config = new AWS.ConfigService();
66
const APPLICABLE_RESOURCES = ['AWS::IAM::Role'];
77

88
exports.handler = async function (event, context) {
9-
console.log(`Custom Rule for checking Polocies attached to IAM role used under Instance Profile...`);
9+
console.log(`Custom Rule for checking Policies attached to IAM role used under Instance Profile...`);
1010
console.log(JSON.stringify(event, null, 2));
1111

1212
const invokingEvent = JSON.parse(event.invokingEvent);
@@ -56,6 +56,11 @@ async function evaluateCompliance(props) {
5656
complianceType: 'NOT_APPLICABLE',
5757
annotation: 'The configuration item was deleted and could not be validated',
5858
};
59+
} else if (configurationItem.configurationItemStatus === 'ResourceNotRecorded' || configurationItem.configurationItemStatus === 'ResourceDeletedNotRecorded') {
60+
return {
61+
complianceType: 'NOT_APPLICABLE',
62+
annotation: 'The configuration item is not recorded in this region and need not be validated',
63+
};
5964
}
6065

6166
if (configurationItem.configuration && !configurationItem.configuration.instanceProfileList) {

0 commit comments

Comments
 (0)