# hkb-site-cutoff

Execution role of the hkb-site-cutoff function. Disables the site distribution, nothing else.

- **Lives in:** [Prod](/architecture/prod/). **Trusted by:** `lambda.amazonaws.com`.
- **Boundary:** `hkb-pipeline-boundary`.
- **Reach:** 5 named actions across 3 services (cloudformation, cloudfront, logs); 0 statements on all resources.
- **Source:** `baseline/hkb-baseline-site-cutoff.yaml`, resource `CutoffRole`.

## Trust policy

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

## Permissions

```yaml
Policies:
  - PolicyName: hkb-site-cutoff
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Sid: ReadSiteStack
          Effect: Allow
          Action: cloudformation:DescribeStacks
          Resource: !Sub arn:${AWS::Partition}:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${SiteStackName}/*
        - Sid: DisableSiteDistribution
          Effect: Allow
          Action:
            - cloudfront:GetDistributionConfig
            - cloudfront:UpdateDistribution
          Resource: !Sub arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:distribution/*
          Condition:
            StringEquals:
              aws:ResourceTag/Component: site
        - Sid: OwnLogs
          Effect: Allow
          Action:
            - logs:CreateLogStream
            - logs:PutLogEvents
          Resource: !GetAtt CutoffLogGroup.Arn
```
