We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This isn't an issue I just wanted to share how I got the alarms going from all of the other accounts to a central account.
you'll need your account id and the org id (but can do lookups on them)
I had to do both of these policies because the cloudwatch api can't use the org's api for permissions.
data "aws_organizations_organization" "xxxxxxx" {}
resource "aws_sns_topic_policy" "cloudwatch_alarms_ec2_memory" { arn = aws_sns_topic.cloudwatch_alarms_ec2_memory.arn
policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowPublishFromOrganizationAccounts", "Effect": "Allow", "Principal": "", "Action": ["sns:Subscribe","sns:GetTopicAttributes","sns:ListSubscriptionsByTopic"], "Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "${data.aws_organizations_organization.xxxxxxx.id}" } } }, { "Sid": "Allow_Cloudwatch_to_Publish_Alarms_Centrally", "Effect": "Allow", "Principal": { "Service": "cloudwatch.amazonaws.com" }, "Action": "sns:Publish", "Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}" }, { "Sid": "AllowCloudWatchAlarmsToPublish", "Effect": "Allow", "Principal": { "Service": "cloudwatch.amazonaws.com" }, "Action": "SNS:Publish", "Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}", "Condition": { "ArnLike": { "aws:SourceArn": [ "arn:aws:cloudwatch:us-east-2:xxxxxxxxxxxxxx:alarm:", ] } } } ] } EOF }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This isn't an issue I just wanted to share how I got the alarms going from all of the other accounts to a central account.
you'll need your account id and the org id (but can do lookups on them)
I had to do both of these policies because the cloudwatch api can't use the org's api for permissions.
data "aws_organizations_organization" "xxxxxxx" {}
resource "aws_sns_topic_policy" "cloudwatch_alarms_ec2_memory" {
arn = aws_sns_topic.cloudwatch_alarms_ec2_memory.arn
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublishFromOrganizationAccounts",
"Effect": "Allow",
"Principal": "",
"Action": ["sns:Subscribe","sns:GetTopicAttributes","sns:ListSubscriptionsByTopic"],
"Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}",
"Condition": {
"StringEquals": {
"aws:PrincipalOrgID": "${data.aws_organizations_organization.xxxxxxx.id}"
}
}
},
{
"Sid": "Allow_Cloudwatch_to_Publish_Alarms_Centrally",
"Effect": "Allow",
"Principal": {
"Service": "cloudwatch.amazonaws.com"
},
"Action": "sns:Publish",
"Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}"
},
{
"Sid": "AllowCloudWatchAlarmsToPublish",
"Effect": "Allow",
"Principal": {
"Service": "cloudwatch.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "${aws_sns_topic.cloudwatch_alarms_ec2_memory.arn}",
"Condition": {
"ArnLike": {
"aws:SourceArn": [
"arn:aws:cloudwatch:us-east-2:xxxxxxxxxxxxxx:alarm:",
]
}
}
}
]
}
EOF
}
The text was updated successfully, but these errors were encountered: