feat(iam): add cloudwatch IAM module for the logs controller#443
Merged
Conversation
New infrastructure/aws/iam/cloudwatch module that grants the nullplatform logs controller permission to ship logs and metrics to CloudWatch, via IRSA (OIDC federation) or EKS Pod Identity. Log group/stream actions are scoped to configurable ARN patterns; the role ARN output feeds the base module's cloudwatch_service_account_annotations. Includes tofu tests for both modes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gdrojas
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New module
infrastructure/aws/iam/cloudwatchthat provisions the IAM role + policy the nullplatform logs controller uses to ship logs and metrics to CloudWatch. Supports both IRSA (OIDC federation) and EKS Pod Identity, following the same convention asiam/external_dnsandiam/cert_manager.Why
The base chart's logs controller runs under
nullplatform-pod-metadata-reader-sa. To reach CloudWatch without granting permissions to the node instance role, it needs a scoped IAM role bound to that ServiceAccount. This module creates it; itsnullplatform_cloudwatch_role_arnoutput feeds the base module'scloudwatch_service_account_annotations(added in #441).Permissions
logs:CreateLogGroup/CreateLogStream/PutLogEvents/PutRetentionPolicy/DescribeLogStreams/TagResource/ListTagsForResource— scoped tolog_group_arn_patterns(default: any log group in the account/region; tightenable to a prefix)logs:DescribeLogGroups—*(account-wide list)cloudwatch:PutMetricData—*(no resource-level support)Usage
Testing
tofu test— 11 passed, 0 failed (IRSA + Pod Identity: naming convention, policy actions, log-group scoping, mode isolation, validations).tofu validateandtofu fmtclean.🤖 Generated with Claude Code