{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowPutRuleOnSpecificSourcesAndDetailTypes",
      "Effect": "Allow",
      "Action": "events:PutRule",
      "Resource": "arn:aws:events:*:*:rule/*ControlTower*",
      "Condition": {
        "ForAnyValue:StringEquals": {
          "events:source": "aws.securityhub"
        },
        "ForAllValues:StringEquals": {
          "events:detail-type": "Security Hub Findings - Imported"
        },
        "Null": {
          "events:detail-type": "false"
        },
        "StringEquals": {
          "events:ManagedBy": "controltower.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowOtherOperationsOnRulesManagedByControlTower",
      "Effect": "Allow",
      "Action": [
        "events:DeleteRule",
        "events:EnableRule",
        "events:DisableRule",
        "events:PutTargets",
        "events:RemoveTargets"
      ],
      "Resource": "arn:aws:events:*:*:rule/*ControlTower*",
      "Condition": {
        "StringEquals": {
          "events:ManagedBy": "controltower.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowDescribeOperationsOnRulesManagedByControlTower",
      "Effect": "Allow",
      "Action": [
        "events:DescribeRule",
        "events:ListTargetsByRule"
      ],
      "Resource": "arn:aws:events:*:*:rule/*ControlTower*"
    },
    {
      "Sid": "AllowControlTowerToPublishSecurityNotifications",
      "Effect": "Allow",
      "Action": "sns:publish",
      "Resource": "arn:aws:sns:*:*:aws-controltower-AggregateSecurityNotifications",
      "Condition": {
        "StringEquals": {
          "aws:PrincipalAccount": "${aws:ResourceAccount}"
        }
      }
    },
    {
      "Sid": "AllowActionsForSecurityHubIntegration",
      "Effect": "Allow",
      "Action": [
        "securityhub:DescribeStandardsControls",
        "securityhub:GetEnabledStandards"
      ],
      "Resource": "arn:aws:securityhub:*:*:hub/default"
    },
    {
      "Sid": "AllowDeleteConfigRule",
      "Effect": "Allow",
      "Action": [
        "config:DeleteConfigRule"
      ],
      "Resource": "arn:aws:config:*:*:config-rule/aws-service-rule/controltower.*/*"
    },
    {
      "Sid": "AllowPutConfigRule",
      "Effect": "Allow",
      "Action": [
        "config:PutConfigRule"
      ],
      "Resource": "arn:aws:config:*:*:config-rule/aws-service-rule/controltower.*/*"
    },
    {
      "Sid": "AllowConfigTagResource",
      "Effect": "Allow",
      "Action": [
        "config:TagResource"
      ],
      "Resource": "arn:aws:config:*:*:config-rule/aws-service-rule/controltower.*/*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/aws-control-tower": "managed-by-control-tower"
        }
      }
    },
    {
      "Sid": "AllowConfigRulesDescribe",
      "Effect": "Allow",
      "Action": [
        "config:DescribeConfigRules"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowControlTowerToCreateConfigAggregator",
      "Effect": "Allow",
      "Action": [
        "config:PutConfigurationAggregator"
      ],
      "Resource": [
        "arn:aws:config:*:*:config-aggregator/aws-service-config-aggregator/controltower.amazonaws.com/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "AllowControlTowerToManageConfigAggregator",
      "Effect": "Allow",
      "Action": [
        "config:DeleteConfigurationAggregator",
        "config:DescribeAggregateComplianceByConfigRules",
        "config:SelectAggregateResourceConfig"
      ],
      "Resource": [
        "arn:aws:config:*:*:config-aggregator/aws-service-config-aggregator/controltower.amazonaws.com/config-aggregator-*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "AllowControlTowerToTagConfigAggregator",
      "Effect": "Allow",
      "Action": [
        "config:TagResource"
      ],
      "Resource": [
        "arn:aws:config:*:*:config-aggregator/aws-service-config-aggregator/controltower.amazonaws.com/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/aws-control-tower": "managed-by-control-tower",
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "AllowControlTowerToPassAggregatorRoleToConfig",
      "Effect": "Allow",
      "Action": [
        "iam:PassRole"
      ],
      "Resource": [
        "arn:aws:iam::*:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig"
      ],
      "Condition": {
        "StringEquals": {
          "iam:PassedToService": "config.amazonaws.com",
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "AllowDescribeConfigurationAggregators",
      "Effect": "Allow",
      "Action": [
        "config:DescribeConfigurationAggregators"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "AllowListDelegatedAdministratorsForConfig",
      "Effect": "Allow",
      "Action": [
        "organizations:ListDelegatedAdministrators"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "StringEquals": {
          "organizations:ServicePrincipal": "config.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowListDescribeOrganization",
      "Effect": "Allow",
      "Action": [
        "organizations:DescribeOrganization"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "AllowActionsForCloudFormationHooksIntegration",
      "Effect": "Allow",
      "Action": [
        "cloudformation:SetTypeConfiguration",
        "cloudformation:DeactivateType",
        "cloudformation:ActivateType"
      ],
      "Resource": "arn:aws:cloudformation:*:*:type/hook/AWS-ControlTower*"
    },
    {
      "Sid": "AllowBatchDescribeTypeConfigurationsForHookConfigFetch",
      "Effect": "Allow",
      "Action": "cloudformation:BatchDescribeTypeConfigurations",
      "Resource": "*"
    }
  ]
}
