Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions charts/platform-code-test-app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: platform-code-test-app
description: Platform code test application
type: application
version: 0.1.0
appVersion: "1.0"
3 changes: 3 additions & 0 deletions charts/platform-code-test-app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "platform-code-test-app.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
43 changes: 43 additions & 0 deletions charts/platform-code-test-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "platform-code-test-app.name" . }}
labels:
app: {{ include "platform-code-test-app.name" . }}
spec:
selector:
matchLabels:
app: {{ include "platform-code-test-app.name" . }}
template:
metadata:
labels:
app: {{ include "platform-code-test-app.name" . }}
spec:
containers:
- name: app
image: {{ .Values.image.repository }}
resources:
limits:
cpu: {{ .Values.resources.limits.cpu | quote }}
memory: {{ .Values.resources.limits.memory }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
{{- if or .Values.db.host .Values.db.existingSecret }}
env:
{{- if .Values.db.host }}
- name: DB_HOST
value: {{ .Values.db.host | quote }}
{{- end }}
{{- if .Values.db.user }}
- name: DB_USER
Comment on lines +26 to +33

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env: block is only rendered when db.host or db.existingSecret is set, but not when only db.user is set. This makes db.user a no-op unless another DB value is also provided. Consider gating env: on any of db.host, db.user, or db.existingSecret (or always rendering env: and conditionally including individual vars).

Copilot uses AI. Check for mistakes.
value: {{ .Values.db.user | quote }}
{{- end }}
{{- if .Values.db.existingSecret }}
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.db.existingSecret }}
key: DB_PASSWORD
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/platform-code-test-app/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
image:
repository: ""

nameOverride: ""

resources:
limits:
cpu: "0.5"
memory: 512Mi
requests:
cpu: 250m
memory: 512Mi

db:
host: ""
user: ""
# Name of a Kubernetes Secret containing a DB_PASSWORD key
existingSecret: ""
45 changes: 10 additions & 35 deletions terraform/app_deployment.tf
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
resource "kubernetes_deployment" "app" {
resource "helm_release" "app" {
depends_on = [
aws_eks_fargate_profile.apps_default,
]

metadata {
name = var.app_name
}

spec {
selector {
match_labels = {
app = var.app_name
}
}
name = var.app_name
chart = "${path.module}/../charts/platform-code-test-app"

template {
metadata {
labels = {
app = var.app_name
}
}

spec {
container {
image = data.aws_ecr_image.app_image.image_uri
name = "app"
set {
name = "nameOverride"
value = var.app_name
}

resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "250m"
memory = "512Mi"
}
}
}
}
}
set {
name = "image.repository"
value = data.aws_ecr_image.app_image.image_uri
}
}
3 changes: 3 additions & 0 deletions terraform/management.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "aws_iam_role" "kubernetes_cluster_admin" {
name = "kubernetes-cluster-admin"
}

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data source is currently unused anywhere in the Terraform config, so it adds maintenance overhead without affecting behavior. Either wire it into the places that need the cluster-admin role ARN (e.g., access entry / role assumption logic) or remove it until it’s needed.

Suggested change
data "aws_iam_role" "kubernetes_cluster_admin" {
name = "kubernetes-cluster-admin"
}

Copilot uses AI. Check for mistakes.
12 changes: 12 additions & 0 deletions terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
output "db_host" {
value = aws_rds_cluster.test_app.endpoint
}

output "db_user" {
value = var.app_rds_master_username
}

output "db_password" {
value = random_id.test_app_rds_master_password.b64_url
sensitive = true
}
7 changes: 2 additions & 5 deletions terraform/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ provider "aws" {
}

# Kubernetes admin AWS provider, only use this for k8s provider.
# assume_role is omitted — interviewers always take the @deliveroo.co.uk
# bootstrap path. Candidates are given credentials with a direct EKS access entry.
provider "aws" {
region = var.region
alias = "kubernetes_admin"

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With assume_role removed, the aws.kubernetes_admin provider alias no longer differs from the default aws provider. That makes the extra aws_eks_cluster_auth.admin path / token branching redundant; consider collapsing to a single AWS provider + single aws_eks_cluster_auth to reduce configuration complexity.

Copilot uses AI. Check for mistakes.

assume_role {
role_arn = aws_eks_access_entry.cluster_admin.principal_arn
session_name = "Terraform"
}
}

data "aws_eks_cluster" "this" {
Expand Down
Loading