Skip to content

Commit fddab2b

Browse files
committed
cleanup comments
1 parent 5a6ced8 commit fddab2b

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

aws_attach_integration_permissions/attach_integration_permissions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def fetch_permissions_from_datadog():
3737
def cleanup_existing_policies(iam_client, role_name, account_id, max_policies=20):
3838
"""Clean up existing managed policies (both new and legacy naming)"""
3939
# Clean up policies with ManagedPolicy naming (e.g., DatadogIntegrationRole-ManagedPolicy-1)
40-
# This covers both quickstart policies and our own policies
4140
for i in range(1, max_policies + 1):
4241
policy_name = f"{role_name}-ManagedPolicy-{i}"
4342
policy_arn = get_policy_arn(account_id, policy_name)
@@ -112,9 +111,8 @@ def handle_create_update(event, context, role_name, account_id):
112111
iam_client = boto3.client('iam')
113112
cleanup_existing_policies(iam_client, role_name, account_id)
114113

115-
# Create and attach new policies using quickstart naming convention
114+
# Create and attach new policies
116115
for i, chunk in enumerate(permission_chunks):
117-
# Create policy (start at 1 to match quickstart convention)
118116
policy_name = f"{role_name}-ManagedPolicy-{i+1}"
119117
policy_document = {
120118
"Version": "2012-10-17",

aws_attach_integration_permissions/main.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ Resources:
9797
def cleanup_existing_policies(iam_client, role_name, account_id, max_policies=20):
9898
"""Clean up existing managed policies (both new and legacy naming)"""
9999
# Clean up policies with ManagedPolicy naming (e.g., DatadogIntegrationRole-ManagedPolicy-1)
100-
# This covers both quickstart policies and our own policies
101100
for i in range(1, max_policies + 1):
102101
policy_name = f"{role_name}-ManagedPolicy-{i}"
103102
policy_arn = get_policy_arn(account_id, policy_name)
@@ -172,9 +171,8 @@ Resources:
172171
iam_client = boto3.client('iam')
173172
cleanup_existing_policies(iam_client, role_name, account_id)
174173
175-
# Create and attach new policies using quickstart naming convention
174+
# Create and attach new policies
176175
for i, chunk in enumerate(permission_chunks):
177-
# Create policy (start at 1 to match quickstart convention)
178176
policy_name = f"{role_name}-ManagedPolicy-{i+1}"
179177
policy_document = {
180178
"Version": "2012-10-17",
@@ -196,6 +194,7 @@ Resources:
196194
RoleName=role_name,
197195
PolicyArn=policy['Policy']['Arn']
198196
)
197+
199198
# Attach the SecurityAudit policy
200199
iam_client.attach_role_policy(
201200
RoleName=role_name,

0 commit comments

Comments
 (0)