Skip to content

[AWSINTS-690] Remove enumerated IAM permissions from aws_organizations template#332

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
ray.eah/awsints-690-dynamic-iam-permissions
Jun 26, 2026
Merged

[AWSINTS-690] Remove enumerated IAM permissions from aws_organizations template#332
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
ray.eah/awsints-690-dynamic-iam-permissions

Conversation

@raymondeah

@raymondeah raymondeah commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Motivation

IAM permissions for the Datadog AWS Integration role are hardcoded, which adds friction when permissions need to be updated. We can automate this by retrieving the required permissions from the Datadog API endpoints https://docs.datadoghq.com/api/latest/aws-integration/get-aws-integration-standard-iam-permissions/ and https://docs.datadoghq.com/api/latest/aws-integration/get-resource-collection-iam-permissions/

Changes

Removes:

  • DatadogAWSIntegrationPolicy
  • DatadogIntegrationRoleManagedPolicy{1–4}

Adds:

  • DatadogAttachIntegrationPermissionsFunction
    • Lambda function that retrieves required IAM permissions and attaches them to the IAM role
  • DatadogAttachIntegrationPermissionsLambdaExecutionRole
    • IAM role which allows the Lambda to be executed
  • DatadogAttachIntegrationPermissionsFunctionTrigger
    • CloudFormation custom resource which triggers the Lambda

Testing

link to new template

This PR is very similar to #250 which implemented the same change in the aws_quickstart template. Additions are copied over from aws_quickstart

  • smoke tested successful deployment of new template

…late with dynamic API fetch

The Organizations template had ~600 IAM permissions hardcoded across an inline
policy and four managed policies, requiring a manual template update every time
Datadog's required AWS permissions changed.

Ports the same Lambda-based approach already used in
aws_quickstart/datadog_integration_permissions.yaml: at stack deploy/update
time, a Lambda fetches the current permission list from the Datadog API and
attaches it to the integration role as an inline policy (standard) and chunked
managed policies (resource collection). On stack delete it cleans everything up.

The Lambda's cleanup_legacy_base_policies handles the pre-existing inline policy
name (DatadogAWSIntegrationPolicy) so upgrades from the hardcoded version are
safe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-prod-us1-4

This comment has been minimized.

Copies attach_integration_permissions.py and its test from aws_quickstart/
to aws_organizations/ with API_CALL_SOURCE_HEADER_VALUE = "cfn-organizations".
All 29 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@raymondeah raymondeah changed the title [AWSINTS-690] Replace hardcoded IAM permissions in Organizations template with dynamic API fetch [AWSINTS-690] Remove enumerated IAM permissions from aws_organizations template Jun 25, 2026
@raymondeah raymondeah marked this pull request as ready for review June 25, 2026 18:26
@raymondeah raymondeah requested a review from a team as a code owner June 25, 2026 18:26
@hkrddog

hkrddog commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 26, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-26 14:09:12 UTC ℹ️ Start processing command /merge


2026-06-26 14:09:17 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 4m (p90).


2026-06-26 14:12:03 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 61b2319 into master Jun 26, 2026
7 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the ray.eah/awsints-690-dynamic-iam-permissions branch June 26, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants