# hkb-pipeline-tools-orchestrator

CodePipeline service role for hkb-pipeline-tools. Moves artifacts, starts the Validate build, assumes hkb-pipeline-tools in Security. Deploys nothing itself.

- **Lives in:** [Shared Services](/architecture/shared-services/). **Trusted by:** `codepipeline.amazonaws.com`.
- **Boundary:** `hkb-pipeline-boundary`.
- **Reach:** 14 named actions across 5 services (codebuild, codeconnections, kms, s3, sts); 0 statements on all resources.
- **Source:** `pipeline/hkb-pipeline-foundation.yaml`, resource `ToolsOrchestratorRole`.

## Trust policy

```yaml
AssumeRolePolicyDocument:
  Version: "2012-10-17"
  Statement:
    - Effect: Allow
      Principal:
        Service: codepipeline.amazonaws.com
      Action: sts:AssumeRole
      Condition:
        StringEquals:
          aws:SourceAccount: !Ref AWS::AccountId
        ArnLike:
          aws:SourceArn: !Sub arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:${ToolsPipelineName}
```

## Permissions

```yaml
Policies:
  - PolicyName: hkb-pipeline-tools-orchestrator
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Sid: Artifacts
          Effect: Allow
          Action:
            - s3:GetObject
            - s3:GetObjectVersion
            - s3:PutObject
            - s3:GetBucketLocation
            - s3:ListBucket
          Resource:
            - !GetAtt ArtifactBucket.Arn
            - !Sub ${ArtifactBucket.Arn}/*
        - Sid: ArtifactKey
          Effect: Allow
          Action:
            - kms:Decrypt
            - kms:Encrypt
            - kms:GenerateDataKey*
            - kms:DescribeKey
            - kms:ReEncrypt*
          Resource: !GetAtt PipelineKey.Arn
        - Sid: UseGitHubConnection
          Effect: Allow
          Action: codeconnections:UseConnection
          Resource: !Sub arn:${AWS::Partition}:codeconnections:${AWS::Region}:${AWS::AccountId}:connection/*
        - Sid: RunValidateBuilds
          Effect: Allow
          Action:
            - codebuild:StartBuild
            - codebuild:BatchGetBuilds
          Resource: !Sub arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/hkb-pipeline-validate
        - Sid: AssumeToolsDeployRole
          Effect: Allow
          Action: sts:AssumeRole
          Resource: !Sub arn:${AWS::Partition}:iam::${SecurityAccountId}:role/hkb-pipeline-tools
```
