{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "OrganizationsPolicies",
      "Effect": "Allow",
      "Action": [
        "organizations:ListAccounts",
        "organizations:DescribeOrganization"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "DescribeOrgAccounts",
      "Effect": "Allow",
      "Action": [
        "organizations:DescribeAccount"
      ],
      "Resource": [
        "arn:aws:organizations::*:account/o-*/*"
      ]
    },
    {
      "Sid": "AllowManagementOfServiceLinkedChannel",
      "Effect": "Allow",
      "Action": [
        "cloudtrail:CreateServiceLinkedChannel",
        "cloudtrail:DeleteServiceLinkedChannel",
        "cloudtrail:GetServiceLinkedChannel",
        "cloudtrail:UpdateServiceLinkedChannel"
      ],
      "Resource": "arn:aws:cloudtrail:*:*:channel/aws-service-channel/security-lake/*"
    },
    {
      "Sid": "AllowListServiceLinkedChannel",
      "Effect": "Allow",
      "Action": [
        "cloudtrail:ListServiceLinkedChannels"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowOrganizationTrailValidation",
      "Effect": "Allow",
      "Action": [
        "cloudtrail:DescribeTrails",
        "cloudtrail:GetTrailStatus",
        "cloudtrail:GetEventSelectors"
      ],
      "Resource": "*"
    },
    {
      "Sid": "DescribeAnyVpc",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeVpcs"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ListDelegatedAdmins",
      "Effect": "Allow",
      "Action": [
        "organizations:ListDelegatedAdministrators"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "organizations:ServicePrincipal": "securitylake.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowWafLoggingConfiguration",
      "Effect": "Allow",
      "Action": [
        "wafv2:PutLoggingConfiguration",
        "wafv2:GetLoggingConfiguration",
        "wafv2:ListLoggingConfigurations",
        "wafv2:DeleteLoggingConfiguration"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "wafv2:LogScope": "SecurityLake"
        }
      }
    },
    {
      "Sid": "AllowPutLoggingConfiguration",
      "Effect": "Allow",
      "Action": [
        "wafv2:PutLoggingConfiguration"
      ],
      "Resource": "*",
      "Condition": {
        "ArnLike": {
          "wafv2:LogDestinationResource": "arn:aws:s3:::aws-waf-logs-security-lake-*"
        }
      }
    },
    {
      "Sid": "ListWebACLs",
      "Effect": "Allow",
      "Action": [
        "wafv2:ListWebACLs"
      ],
      "Resource": "*"
    },
    {
      "Sid": "LogDelivery",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogDelivery",
        "logs:DeleteLogDelivery"
      ],
      "Resource": "*",
      "Condition": {
        "ForAnyValue:StringEquals": {
          "aws:CalledVia": [
            "wafv2.amazonaws.com"
          ]
        }
      }
    }
  ]
}
