# hkb-master-org-cfn

CloudFormation service role for hkb-org-mgmt-policies and hkb-org-declarative only, on hand-run change sets (DQ-24).

- **Lives in:** [Management](/architecture/management/). **Trusted by:** `cloudformation.amazonaws.com`.
- **Boundary:** `hkb-pipeline-boundary`.
- **Reach:** 10 named actions across 2 services (organizations, ssm); 2 statements on all resources.
- **Source:** `bootstrap/hkb-master-org-cfn.yaml`, resource `MasterOrgCfnRole`.

## Trust policy

```yaml
AssumeRolePolicyDocument:
  Version: "2012-10-17"
  Statement:
    - Effect: Allow
      Principal:
        Service: cloudformation.amazonaws.com
      Action: sts:AssumeRole
      Condition:
        StringEquals:
          aws:SourceAccount: !Ref AWS::AccountId
```

## Permissions

```yaml
Policies:
  - PolicyName: hkb-master-org-cfn
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Sid: ManageTagAiOptOutAndDeclarativePolicies
          Effect: Allow
          Action:
            - organizations:CreatePolicy
            - organizations:UpdatePolicy
            - organizations:DeletePolicy
            - organizations:AttachPolicy
            - organizations:DetachPolicy
            - organizations:TagResource
            - organizations:UntagResource
          Resource: "*"
          Condition:
            StringEquals:
              "organizations:PolicyType":
                - TAG_POLICY
                - AISERVICES_OPT_OUT_POLICY
                - DECLARATIVE_POLICY_EC2
        - Sid: ReadOrganizations
          Effect: Allow
          Action:
            - organizations:Describe*
            - organizations:List*
          Resource: "*"
        - Sid: ResolveIdParameters
          Effect: Allow
          Action: ssm:GetParameters
          Resource: !Sub arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/hkb/aws/*
```
