Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
35c66e0
Updated git ignore and triggers TF deploy.
tanderegg Dec 23, 2025
9bf1748
Merge pull request #130 from resource-watch/update_gitignore
tanderegg Dec 23, 2025
7b4418b
Update policy to Cluster Admin.
tanderegg Dec 23, 2025
96d4805
Merge pull request #131 from resource-watch/cluster_admin
tanderegg Dec 23, 2025
f7aa48c
upgrade kubernetes version to 1.30
Jan 7, 2026
6df16b6
set hibernate attribute as false
Jan 8, 2026
85c1397
comment eks_node_release_version
Jan 8, 2026
2410e58
set default value to eks_node_release_version variable
Jan 8, 2026
22b1238
set undo comments
Jan 8, 2026
608a4c2
Merge pull request #133 from resource-watch/feature/dev-eks-upgrade
anauecuri Jan 12, 2026
ad8fd34
set ebs_csi_addon_version as null
Jan 12, 2026
55a1bbf
update ebs_csi_addon_version variable to v1.30.0-eksbuild.1 to solve …
Jan 12, 2026
b0a4c4e
Merge pull request #134 from resource-watch/feature/dev-eks-upgrade
anauecuri Jan 12, 2026
1e5a6b6
add kube-proxy as add-on compatible with kubernetes 1.30
Jan 12, 2026
a8c9cf7
Merge pull request #135 from resource-watch/feature/dev-eks-upgrade
anauecuri Jan 12, 2026
4d3b924
Merge pull request #137 from resource-watch/staging
tanderegg Jan 21, 2026
2b6fa3f
Refresh TF state.
tanderegg Jan 23, 2026
8144fec
Adds access entry for GHA OIDC role.
tanderegg Feb 6, 2026
da4aac3
Merge pull request #139 from resource-watch/add_oidc_role_to_eks
tanderegg Feb 6, 2026
3b3833c
Add TF Plan to GHA for k8s, and fix cloudflare keys.
tanderegg Jan 26, 2026
339011a
Add steps to existing job in order to ensure sequential run.
tanderegg Jan 26, 2026
f768b69
Ensure AWS cli is installed.
tanderegg Jan 26, 2026
63fb177
Build custom image with AWS CLI installed.
tanderegg Jan 27, 2026
ff91388
Add kubeconfig setup.
tanderegg Jan 27, 2026
1ef1085
Run each module separately to avoid token timeout
tanderegg Feb 5, 2026
29ea450
Adds access entry for GHA OIDC role.
tanderegg Feb 6, 2026
fcb14d7
Upload plan file as artifact.
tanderegg Feb 10, 2026
02be86d
Use plan artifact in apply.
tanderegg Feb 10, 2026
46f6685
Missed a dash.
tanderegg Feb 11, 2026
7d5e42a
Merge pull request #138 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
34e06c7
Fix indentation issue.
tanderegg Feb 11, 2026
ad751ef
Merge pull request #140 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
b54c5ca
Get closed PR which should be the one that was merged.
tanderegg Feb 11, 2026
3248b20
Merge pull request #141 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
afd298b
Don't pass vars when using plan file.
tanderegg Feb 11, 2026
9b5ca5b
Merge pull request #142 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
17060a4
Missed a dash.
tanderegg Feb 11, 2026
fbdf305
Merge pull request #143 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
964c819
Fixes dashes in path...
tanderegg Feb 11, 2026
5336292
Merge pull request #144 from resource-watch/add_tf_k8s_pipeline
tanderegg Feb 11, 2026
221ff03
Fix helm chart for redis.
tanderegg Feb 11, 2026
7890082
Merge pull request #145 from resource-watch/fix_helm_chart
tanderegg Feb 11, 2026
ea42371
Actually use proper AWS role for apply.
tanderegg Feb 11, 2026
f91ac38
Merge pull request #146 from resource-watch/fix_helm_chart
tanderegg Feb 11, 2026
8bb8143
Add value back in to redis chart values.
tanderegg Feb 11, 2026
91052c9
Merge pull request #147 from resource-watch/fix_helm_chart
tanderegg Feb 11, 2026
7947e9b
Temporarily allow force update on Redis chart.
tanderegg Feb 11, 2026
f38075d
Merge pull request #148 from resource-watch/fix_helm_chart
tanderegg Feb 11, 2026
9f528c9
Updates image and charts.
tanderegg Feb 12, 2026
88c8c72
Update postgresql chart repo.
tanderegg Feb 12, 2026
c21ec41
Merge pull request #150 from resource-watch/update_pg_and_rabbit
tanderegg Feb 12, 2026
bf773d7
Updates postgresql helm chart and turns on GHA concurrency group.
tanderegg Feb 12, 2026
ea217a7
Merge pull request #152 from resource-watch/update_pg_and_rabbit
tanderegg Feb 12, 2026
39e19d3
Fixed download error.
tanderegg Feb 13, 2026
f1578c4
Merge pull request #153 from resource-watch/update_pg_and_rabbit
tanderegg Feb 13, 2026
7cd3023
Remove potential chart and folder naming conflicts.
tanderegg Feb 13, 2026
48906b7
Merge pull request #154 from resource-watch/update_pg_and_rabbit
tanderegg Feb 13, 2026
c49bec4
Attemp to update rabbitmq as well.
tanderegg Feb 13, 2026
d651a71
Merge pull request #156 from resource-watch/update_pg_and_rabbit
tanderegg Feb 13, 2026
12965ef
Use OCI URI's.
tanderegg Feb 13, 2026
896cfda
Merge pull request #157 from resource-watch/update_pg_and_rabbit
tanderegg Feb 13, 2026
0cc579b
Fix image tags.
tanderegg Feb 13, 2026
579ec6c
Merge pull request #159 from resource-watch/update_pg_and_rabbit
tanderegg Feb 13, 2026
28f8be6
Extend helm timeouts to 20 min.
tanderegg Feb 14, 2026
249a5b0
Merge pull request #160 from resource-watch/update_pg_and_rabbit
tanderegg Feb 14, 2026
45ea805
Fix pod name, try resolving hba.conf path issue.
tanderegg Feb 20, 2026
0439277
Vend older postgresql helm chart and fix values / pvc.
tanderegg Feb 24, 2026
5c29e8d
Fixed RabbitMQ.
tanderegg Feb 24, 2026
3611a45
Adds vended RabbitMQ chart.
tanderegg Feb 24, 2026
85c4176
Remove uneccessary volume permissions and add new role for ISRA.
tanderegg Feb 26, 2026
2c01853
Fix resource names.
tanderegg Feb 26, 2026
6690a6d
Merge pull request #161 from resource-watch/update_pg_and_rabbit_vend…
tanderegg Feb 26, 2026
c994c2b
Adds GH OIDC docs and updates staging TF vars.
tanderegg Feb 26, 2026
c265e7d
Merge pull request #163 from resource-watch/update_staging_vars
tanderegg Feb 26, 2026
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
148 changes: 119 additions & 29 deletions .github/workflows/terraform_build.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,136 @@
name: Run tests and apply terraform changes for current branch

concurrency:
group: deploy-terraform
cancel-in-progress: false

on:
push:
branches: [dev, staging]

permissions:
id-token: write
contents: read
pull-requests: read
actions: read

jobs:
build_dev:
build_eks_cluster:
runs-on: ubuntu-latest

env:
ENV: ${{ github.ref_name }}
AWS_ACCESS_KEY_ID: >-
${{ github.ref_name == 'production' && secrets.aws_key_production ||
github.ref_name == 'staging' && secrets.aws_key_staging ||
secrets.aws_key_dev }}
AWS_SECRET_ACCESS_KEY: >-
${{ github.ref_name == 'production' && secrets.aws_secret_production ||
github.ref_name == 'staging' && secrets.aws_secret_staging ||
secrets.aws_secret_dev }}
AWS_REGION: >-
${{ github.ref_name == 'production' && secrets.aws_region_production ||
github.ref_name == 'staging' && secrets.aws_region_staging ||
secrets.aws_region_dev }}
TF_VAR_cloudflare_api_key: ${{ secrets.cloudflare_api_key }}
TF_VAR_cloudflare_email: ${{ secrets.cloudflare_email }}
TF_VAR_sparkpost_api_key: ${{ secrets.sparkpost_api_key }}
ENV: ${{ github.ref_name }}
AWS_ACCESS_KEY_ID: >-
${{ github.ref_name == 'production' && secrets.aws_key_production ||
github.ref_name == 'staging' && secrets.aws_key_staging ||
secrets.aws_key_dev }}
AWS_SECRET_ACCESS_KEY: >-
${{ github.ref_name == 'production' && secrets.aws_secret_production ||
github.ref_name == 'staging' && secrets.aws_secret_staging ||
secrets.aws_secret_dev }}
AWS_REGION: >-
${{ github.ref_name == 'production' && secrets.aws_region_production ||
github.ref_name == 'staging' && secrets.aws_region_staging ||
secrets.aws_region_dev }}
TF_VAR_cloudflare_api_key: ${{ secrets.cloudflare_api_key }}
TF_VAR_cloudflare_email: ${{ secrets.cloudflare_email }}
TF_VAR_sparkpost_api_key: ${{ secrets.sparkpost_api_key }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Setup terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.6

- name: TF Init
run: ./scripts/infra -chdir=terraform init -backend-config=vars/backend-$ENV.tfvars
run: terraform -chdir=terraform init -backend-config=vars/backend-$ENV.tfvars

#- name: TF Plan
# run: |
# terraform -chdir=terraform plan -var-file=vars/terraform-$ENV.tfvars \
# -var "cloudflare_api_key=${TF_VAR_cloudflare_api_key}" \
# -var "cloudflare_email=${TF_VAR_cloudflare_email}" \
# -var "sparkpost_api_key=${TF_VAR_sparkpost_api_key}" \
# -out tf.plan

- name: Get PR Number
uses: jwalton/gh-find-current-pr@master
id: findpr
with:
state: closed

- name: Download TF EKS Cluster Plan
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: terraform_plan.yaml
pr: ${{ steps.findpr.outputs.pr }}
name: tf_eks-${{ steps.findpr.outputs.pr }}.plan
path: terraform/
check_artifacts: true

- name: TF Plan
run: |
./scripts/infra -chdir=terraform plan -var-file=vars/terraform-$ENV.tfvars \
-var "cloudflare_api_key=${TF_VAR_cloudflare_api_key}" \
-var "cloudflare_email=${TF_VAR_cloudflare_email}" \
-var "sparkpost_api_key=${TF_VAR_sparkpost_api_key}"
- name: TF Apply
run: |
./scripts/infra -chdir=terraform apply -auto-approve -var-file=vars/terraform-$ENV.tfvars \
-var "cloudflare_api_key=${TF_VAR_cloudflare_api_key}" \
-var "cloudflare_email=${TF_VAR_cloudflare_email}" \
-var "sparkpost_api_key=${TF_VAR_sparkpost_api_key}"
terraform -chdir=terraform apply tf_eks-${{ steps.findpr.outputs.pr }}.plan

build_k8s_infra:
runs-on: ubuntu-latest
needs: build_eks_cluster

env:
ENV: ${{ github.ref_name }}
AWS_ROLE: >-
${{ github.base_ref == 'production' && 'TBD' ||
github.base_ref == 'staging' && 'TBD' ||
'arn:aws:iam::842534099497:role/wri-api-dev-githubactions-role' }}
AWS_REGION: >-
${{ github.ref_name == 'production' && secrets.aws_region_production ||
github.ref_name == 'staging' && secrets.aws_region_staging ||
secrets.aws_region_dev }}
TF_VAR_cloudflare_api_key: ${{ secrets.cloudflare_api_key }}
TF_VAR_cloudflare_email: ${{ secrets.cloudflare_email }}
TF_VAR_sparkpost_api_key: ${{ secrets.sparkpost_api_key }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@main
with:
role-to-assume: ${{ env.AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}

- name: Setup terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.6

- name: Configure Kubeconfig
run: aws eks update-kubeconfig --region us-east-1 --name core-k8s-cluster-$ENV

- name: TF Init K8s Infra
run: terraform -chdir=terraform-k8s-infrastructure init -backend-config=vars/backend-$ENV.tfvars

- name: Get PR Number
uses: jwalton/gh-find-current-pr@master
id: findpr
with:
state: closed

- name: Download TF k8s Infra Plan
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: terraform_plan.yaml
pr: ${{ steps.findpr.outputs.pr }}
name: tf_k8s_infra-${{ steps.findpr.outputs.pr }}.plan
path: terraform-k8s-infrastructure/
check_artifacts: true

- name: TF Apply
run: |
terraform -chdir=terraform-k8s-infrastructure apply \
tf_k8s_infra-${{ steps.findpr.outputs.pr }}.plan
92 changes: 84 additions & 8 deletions .github/workflows/terraform_plan.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: Plan terraform changes for base branch
name: Terraform Plan

concurrency:
group: deploy-terraform
cancel-in-progress: false

on:
pull_request:
branches: [dev, staging]

permissions:
id-token: write

jobs:
plan:
plan_eks_cluster:
runs-on: ubuntu-latest

env:
Expand All @@ -27,14 +34,83 @@ jobs:
TF_VAR_sparkpost_api_key: ${{ secrets.sparkpost_api_key }}

steps:
- uses: actions/checkout@v1
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.6

- name: TF Init EKS Cluster
run: terraform -chdir=terraform init -backend-config=vars/backend-$ENV.tfvars

- name: TF Plan EKS Cluster
run: |
terraform -chdir=terraform plan -var-file=vars/terraform-$ENV.tfvars \
-var "cloudflare_api_key=${TF_VAR_cloudflare_api_key}" \
-var "cloudflare_email=${TF_VAR_cloudflare_email}" \
-var "sparkpost_api_key=${TF_VAR_sparkpost_api_key}" \
-out tf_eks-${{ github.event.pull_request.number }}.plan

- name: Upload EKS Cluster Plan File
uses: actions/upload-artifact@v4
with:
name: tf_eks-${{ github.event.pull_request.number }}.plan
path: "terraform/tf_eks-${{ github.event.pull_request.number }}.plan"
if-no-files-found: 'error'
overwrite: true

plan_k8s_infra:
runs-on: ubuntu-latest
needs: plan_eks_cluster

env:
ENV: ${{ github.base_ref }}
AWS_ROLE: >-
${{ github.base_ref == 'production' && 'TBD' ||
github.base_ref == 'staging' && 'TBD' ||
'arn:aws:iam::842534099497:role/wri-api-dev-githubactions-role' }}
AWS_REGION: >-
${{ github.base_ref == 'production' && secrets.aws_region_production ||
github.base_ref == 'staging' && secrets.aws_region_staging ||
secrets.aws_region_dev }}
TF_VAR_cloudflare_api_key: ${{ secrets.cloudflare_api_key }}
TF_VAR_cloudflare_email: ${{ secrets.cloudflare_email }}
TF_VAR_sparkpost_api_key: ${{ secrets.sparkpost_api_key }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@main
with:
role-to-assume: ${{ env.AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}

- name: Setup terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.6

- name: Configure Kubeconfig
run: aws eks update-kubeconfig --region us-east-1 --name core-k8s-cluster-$ENV

- name: TF Init
run: ./scripts/infra -chdir=terraform init -backend-config=vars/backend-$ENV.tfvars
- name: TF Init K8s Infra
run: terraform -chdir=terraform-k8s-infrastructure init -backend-config=vars/backend-$ENV.tfvars

- name: TF Plan
- name: TF Plan K8s Infra
run: |
./scripts/infra -chdir=terraform plan -var-file=vars/terraform-$ENV.tfvars \
terraform -chdir=terraform-k8s-infrastructure plan -var-file=vars/terraform-$ENV.tfvars \
-var "cloudflare_api_key=${TF_VAR_cloudflare_api_key}" \
-var "cloudflare_email=${TF_VAR_cloudflare_email}" \
-var "sparkpost_api_key=${TF_VAR_sparkpost_api_key}"
-out tf_k8s_infra-${{ github.event.pull_request.number }}.plan

- name: Upload K8s Infrastructure Plan File
uses: actions/upload-artifact@v4
with:
name: tf_k8s_infra-${{ github.event.pull_request.number }}.plan
path: "terraform-k8s-infrastructure/tf_k8s_infra-${{ github.event.pull_request.number }}.plan"
if-no-files-found: 'error'
overwrite: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ crash.log
# version control.
#
# example.tfvars
*.auto.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
Expand Down Expand Up @@ -52,3 +53,6 @@ terraform-k8s-infrastructure/vars/private.tfvars

terraform.tfstate
terraform.tfstate.backup

# Snyk Security Extension - AI Rules (auto-generated)
.github/instructions/snyk_rules.instructions.md
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

For a description of the setup, see the infrastructure [section](https://resource-watch.github.io/doc-api/developer.html#infrastructure-configuration) of the developer documentation.

# Github Actions
Github Actions (GHA) has been setup to run `terraform plan` when a PR is opened to either the `dev`, `staging`, or `production` (TODO) branches, and `terraform apply` when the PR is merged. This makes use of an OIDC role as described here: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws. The role for each environment was created manually, and is specified using the `gha_role_arn` Terraform variable.

## Setting up the AWS resources

To setup the cluster cloud resources, use the following command:
Expand Down
4 changes: 4 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# PVC Debugger

export PVC_NAME=<my-pvc-name>
envsubst < pvc-debugger.yaml | kubectl apply -n <namespace> -f -
17 changes: 17 additions & 0 deletions scripts/pvc-debugger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: volume-debugger
spec:
volumes:
- name: volume-to-debug
persistentVolumeClaim:
claimName: ${PVC_NAME} # Replace with your PVC name
containers:
- name: debugger
image: busybox:stable
command: ['sleep', '3600'] # Keeps the pod running
volumeMounts:
- mountPath: "/data" # The path where the volume will be mounted
name: volume-to-debug
restartPolicy: Never
Loading
Loading