Skip to content

AWS-specific edits before apply

AWS needs no edit to complete an installation. Both OIDC values are supplied as flags, so every value resolves at render time and up runs it end to end.

What follows is for the cases where your account requires something the install flags do not express.

Narrow the ECR grant

The ECR policy uses Resource = "*":

      Action = ["ecr:GetAuthorizationToken", "ecr:BatchGetImage", "ecr:GetDownloadUrlForLayer", "ecr:PutImage", "ecr:UploadLayerPart", "ecr:InitiateLayerUpload", "ecr:CompleteLayerUpload", "ecr:BatchCheckLayerAvailability"]
      Resource = "*"

ecr:GetAuthorizationToken has to stay account-scoped, so the narrowing is a split into two statements:

    Statement = [
      {
        Effect   = "Allow"
        Action   = ["ecr:GetAuthorizationToken"]
        Resource = "*"
      },
      {
        Effect = "Allow"
        Action = ["ecr:BatchGetImage", "ecr:GetDownloadUrlForLayer", "ecr:PutImage", "ecr:UploadLayerPart", "ecr:InitiateLayerUpload", "ecr:CompleteLayerUpload", "ecr:BatchCheckLayerAvailability"]
        Resource = "arn:aws:ecr:<region>:<aws-account-id>:repository/<repository>"
      }
    ]

Add a permissions boundary

Accounts that require a boundary on every role add it to both:

resource "aws_iam_role" "runtime" {
  name                 = "dp-eu-west1-runtime"
  assume_role_policy   = data.aws_iam_policy_document.runtime_assume_role.json
  permissions_boundary = "arn:aws:iam::<aws-account-id>:policy/<boundary-policy>"
}

Add tags

  tags = {
    Owner       = "platform"
    Environment = "prod"
  }

Point STS and ECR at VPC endpoints

On a private network, set these in the spec rather than the rendered file:

provider_config:
  aws_sts_endpoint: https://vpce-0abc-sts.<region>.vpce.amazonaws.com
  aws_ecr_api_endpoint: https://vpce-0abc-ecr.<region>.vpce.amazonaws.com

See Air-gapped deployment for the endpoint fields each provider requires.

Where to make each change

Change Put it in
Endpoints, namespaces, images, node count, approved namespaces install.input.yaml
Policy scope, permissions boundaries, tags terraform/main.tf
The registry and bucket themselves Your own infrastructure, outside the bundle

Spec changes survive a re-prepare; edits to rendered files are rewritten by it. See Editing generated files.

Before you apply

cd install/dp-eu-west1/terraform
terraform init
terraform plan

Read the trust policies in the plan. They are the part that fails silently after apply if either OIDC value is wrong. See Cluster OIDC values.