-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
fix: Give SNS feedback access to CloudWatch #237
base: master
Are you sure you want to change the base?
Conversation
This PR has been automatically marked as stale because it has been open 30 days |
This is still valid. Commenting to keep it open |
This PR has been automatically marked as stale because it has been open 30 days |
Not stale |
statement { | ||
effect = "Allow" | ||
actions = [ | ||
"logs:CreateLogGroup", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terraform creates the log group, this one can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are the 2 SNS log groups being created? I see a log group for Lambda logs, but that is different. I believe this permission is necessary for the sns/:region/:account/:topic
and sns/:region/:account/:topic/Failure
log groups that are auto-created by SNS (assuming permissions are wired up correctly)
"logs:PutMetricFilter", | ||
"logs:PutRetentionPolicy", | ||
] | ||
resources = ["*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we know the ARN and can scope it with the aws_cloudwatch_log_group
created by the module instead of using a wildcard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that is the log group for Lambda logs, which is not what we want here. We instead need the SNS feedback log groups, per my other comment. I could restrict it down to sns/:region/:account/:topic
and sns/:region/:account/:topic/*
? (I know the /Failure
group is needed, but I'm not sure about others. The reference post just uses *
, so that's not helpful)
@@ -36,3 +53,11 @@ resource "aws_iam_role" "sns_feedback_role" { | |||
var.sns_topic_feedback_role_tags, | |||
) | |||
} | |||
|
|||
resource "aws_iam_role_policy" "sns_feedback_role" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a policy and attach it instead of inline policy. name should not be hardcoded - you can see other modules for references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, can do! Is this what you are referring to? https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/573f574c922782bc658f05523d0c902a4792b0a8/vpc-flow-logs.tf#L115-L129
Would you like me to add a _policy_name and _policy_use_name_prefix variable for this?
Description
Motivation and Context
Breaking Changes
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request