-
Notifications
You must be signed in to change notification settings - Fork 44
update to allow exclusions and record Global IAM resource-types in the Control Tower Home region only. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
add the CONTROL_TOWER_HOME_REGION: !Ref 'AWS::Region' variable for setting the Global Resource recording in the Home region only.
…resources in the Home region. Adds a list and list comprehension to include the 4 global IAM resource-types in recording scope for the Control Tower Home region only. This is necessary since the 'exclusionByResourceTypes' option overrides the 'includeGlobalResourceTypes' option.
Update template.yaml with CONTROL_TOWER_HOME_REGION variable
Update ct_configrecorder_override_consumer.py to only include globals in home region
|
Can you please check and let me know. this is the intended behaviour |
|
@vsr2158 - I can confirm the need for something like this. I've been observing something in my environment that would be fixed by this PR or something like it, and it all seems to key around the documentation for Config collecting IAM. If you look at the config docs here: https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html#select-resources-all - there's a cut over for things onboarded after Feb 2022. In my observation, it seems like Control Tower handled those Global IAM resources in the past by creating an explicit exclude for them in all valid regions except the home region, then the home region was set to Daily. The functionality in this repo undoes that step, so the net config we see is Daily in the Home Region and continuous in all other regions, which is VERY chatty. This PR would reset that to what Control Tower set up in the first place with Daily in the Home Region and Excluded in the others. |
|
The latest code does this. In the home region Other region The parameters being used |
|
Template variable = ConfigRecorderDailyGlobalResourceTypes Lambda env variable = CONTROL_TOWER_HOME_REGION: !Ref "AWS::Region" (set by Cfn templete) Lambda handler uses = CONFIG_RECORDER_DAILY_GLOBAL_RESOURCE_LIST Sets home_region = True based on condition Sets the Daily recording frequency So I think the latest version has that fix. please let me know if I missed anything. |
|
Yes - I'm following that code, and what's in there now works for any IAM setup provisioned after Feb 2022. However - if your Account was provisioned before Feb 2022, this doesn't work. The first block is from your comment is correct, daily for the home region. However, all other regions need an explicit exclude for those global services. Setting the includeGlobalResourceTypes isn't sufficient to prevent collection - so, they fail back to continuous in all other (non-home) regions. |
|
There is more complexity to this after discussing with the Config service developer. IAM resources are NOT recorded in post Feb 2022 launched regions. which means if CT Home region is one of those regions IAM resources will not be recorded at all. Global resource types | IAM resources The following IAM resource types are global resources: IAM users, groups, roles, and customer managed policies. These resource types can be recorded by AWS Config in Regions where AWS Config was available before February 2022. This list where you cannot record the global IAM resource types includes the following Regions: Asia Pacific (Hyderabad), Asia Pacific (Malaysia), Asia Pacific (Melbourne), Asia Pacific (Thailand), Canada West (Calgary), Europe (Spain), Europe (Zurich), Israel (Tel Aviv), Mexico (Central), and Middle East (UAE). NOTE: the doc is not up to date with all the new regions and I have requested to list pre 2022 regions instead. Following options are present to address the IAM resource recording |
Issue #, if available:
How to exclude global resource types #14
#14
Description of changes:
Added variable to CFN template.yaml to get the Control Tower Home region which is the region that deploys the Config BASELINE StackSet and the solution. Consistent with this commit:
4c4eb77
Added a static list of the 4 Global IAM resource-types as reference to add and remove to two new lists created.
Created two new lists for exclusions: one for resource-types to exclude in the Home region and one for resource-types to exclude for all other CT governed regions, which should contain the 4 Global IAM resource-types.
Used a list comprehension to remove or add the 4 Global IAM resource-types accordingly.
Confirm if the region is the CT Home region to select the appropriate exclusion list for the recorder in that region.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.