chore: pin cloudflare provider below 5.20.0 + lock-file check (#72)

This commit is contained in:
Zack Pollard
2026-06-16 15:07:08 +02:00
committed by GitHub
parent 7ff4a53204
commit 55dee4d894
11 changed files with 254 additions and 6 deletions
+18
View File
@@ -9,6 +9,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Test
@@ -44,9 +47,24 @@ jobs:
run: pnpm run test
if: ${{ !cancelled() }}
terraform-lock-files:
name: Terraform lock files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check every module has a committed lock file
run: ./deployment/scripts/check-lock-files.sh
integration-test-cloudflare-metrics:
name: Integration Test (cloudflare-metrics)
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read # dorny/paths-filter reads changed files via the API on pull_request
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+4
View File
@@ -39,6 +39,10 @@ dir = "{{cwd}}"
run = "mise run tf destroy"
dir = "{{cwd}}"
[tasks."tf:check-locks"]
run = "{{config_root}}/deployment/scripts/check-lock-files.sh"
description = "Ensure every Terraform module has a committed .terraform.lock.hcl"
[settings]
experimental = true
idiomatic_version_file_enable_tools = []
@@ -0,0 +1,55 @@
# This file is maintained automatically by "tofu init".
# Manual edits may be lost in future updates.
provider "registry.opentofu.org/cloudflare/cloudflare" {
version = "5.19.1"
constraints = ">= 5.0.0, < 5.20.0"
hashes = [
"h1:HkKPMZ/n+QiExkRUSLjGMTGnuIaph+k932LiTp7CKZM=",
"h1:LicdZu3hugYpWuCAprg2EslbVP0zANnV9n9/2KiOnYc=",
"h1:XYVRvCG+auhkY1NnSe6pK7ClqKW5GX8BgUnMQwfC7mQ=",
"h1:Xf1PHfUfK690caJYZvoudKKBppfleJ6RcqsEQWqKVCw=",
"h1:mopYISyLkUVUwMjJbuPenxIUVDrna1/7ACB1hfMfciU=",
"zh:0651618000db705564dab5a25322b9d76ea54b7dd78931ed3565497b559babeb",
"zh:1a7847e9479fb6d21a65ef933ffae1416b1e4b44ca940c0d6c50fc4248cc4a0d",
"zh:5597cee5854131045eb9f201ae3a70b59c51955d31a647d9616863c746d902cb",
"zh:580786830d93e35b957754fd4c62d4681a3b19abc28b757e41acba26455663b1",
"zh:83c4bdfb0e74fd50e56fff3c461d76c1c1ec61af3f679e4de1aa70b5ed05a09f",
"zh:abb4d1052cee61d80f9cb51e5421e3c118312403afb7104b98bd7e310ac736ee",
"zh:b0aeeb3d66ea4d719989875e778c477065ba941e3a76e9a8caacc3be08208dd9",
"zh:e43b4b2dfcec1ce2115f5a5c86042d432deb49bee8eae103eb56d97ea02e2e3b",
"zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32",
]
}
provider "registry.opentofu.org/grafana/grafana" {
version = "3.25.9"
constraints = "~> 3.0, ~> 3.22"
hashes = [
"h1:5fXaauPL+gsUJAtGiPebhvPors/QNB1NYKK5wiLDGjM=",
"h1:Mr94xUwSKxLJxWxd/zed2K2xb57zE/+18uhIuo5/k44=",
"h1:ddQjGuxcMvrxB2bHBgC5SHI+ueo7KvnZhNRW/5+Nnh4=",
"h1:m19AUS7s6DUOawfYD4OSEXVqxjp7OG/i8ArjcxCDIW0=",
"h1:nNGW1JcrxYZeWO0uKDC6EGvIeKFUb6MZQpIViEtwnD4=",
"zh:052dd83cbf794d6a0c41ef6262286063d64c7b2107f3a6b1b81e679303072759",
"zh:117092dfc73619621eb48046934ef14c09e4419fc6d5bab35bff7549eac905fb",
"zh:153952d2f01812cada014905852c8a03fb68a204b98a533b81830e923bf69848",
"zh:16e9ada001398329ebe0c28be26cb3b71d8a30bd4cc41aa94ec182d671a06b58",
"zh:1eab3a56da8bb9478b0b32e87c3210b82d937d6a9586bd64046840f48486f7a1",
"zh:2e92818816fbac9e52a00d7c2c94b529b2fccdcfcd712c0fef8f4b340658c6ad",
"zh:3518f1973b3942ef380574a6765835204970f39c635b7e1dacde5e2c6a9abf16",
"zh:3ec8c054b91d44cb103ec82484e0974360ad9d4167e035cbfba0c858613f46f1",
"zh:418418c9d9e3e30e6e065d00956c56f78873546ad2c7d52a5fddb3ead207f4f7",
"zh:50009c4adbfe2174984f9c80627eb37c629b2b756acfd79f09b6dde7c6e58c60",
"zh:5482ea23403676f691d765d644519cbb632b1b5c1cfa6f3115705a0512d7d2db",
"zh:55b45e72ff7f186f91e3134eb925718b1e7b3e32aa5c810888f6be1db7242cf4",
"zh:577cc62c2e5e2b6c9eda49c316931318f106b7cbf2f59727d20a16c8a1902637",
"zh:63d43991044566879304f153ef3a1ae50cc4301508888a230462259aac97c7a2",
"zh:76074d9d200c59c707f570603b7b447b48d38ce57b53b54ee921c45b6521d816",
"zh:81141dd99b77fd091f1bd86fff15e6a25abfd92c825e77439457a6eba027f27c",
"zh:a3db02539d1417e326cee4e70ed77bce37bc4586f98b7067a0653e7b608d0cc9",
"zh:a53a7c400f3d8cef527897a95bd4e559e306703706d1dae509963d42423ef006",
"zh:d6b4f270ea3a27542fea8af45323428452563191929e13d3d92a64365dca1694",
"zh:fffaf801f26a13d5a600d6f39f508e7c07ed09e7dd35fc3541d8066236348b6f",
]
}
@@ -5,7 +5,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5"
version = ">= 5, < 5.20.0"
}
grafana = {
source = "grafana/grafana"
@@ -3,7 +3,7 @@
provider "registry.opentofu.org/cloudflare/cloudflare" {
version = "5.19.1"
constraints = ">= 5.0.0"
constraints = ">= 5.0.0, < 5.20.0"
hashes = [
"h1:HkKPMZ/n+QiExkRUSLjGMTGnuIaph+k932LiTp7CKZM=",
"h1:LicdZu3hugYpWuCAprg2EslbVP0zANnV9n9/2KiOnYc=",
@@ -5,7 +5,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = ">= 5"
version = ">= 5, < 5.20.0"
}
}
}
@@ -3,7 +3,7 @@
provider "registry.opentofu.org/cloudflare/cloudflare" {
version = "5.19.1"
constraints = ">= 5.0.0"
constraints = ">= 5.0.0, < 5.20.0"
hashes = [
"h1:HkKPMZ/n+QiExkRUSLjGMTGnuIaph+k932LiTp7CKZM=",
"h1:LicdZu3hugYpWuCAprg2EslbVP0zANnV9n9/2KiOnYc=",
@@ -5,7 +5,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = ">= 5"
version = ">= 5, < 5.20.0"
}
}
}
@@ -0,0 +1,108 @@
# This file is maintained automatically by "tofu init".
# Manual edits may be lost in future updates.
provider "registry.opentofu.org/cloudflare/cloudflare" {
version = "5.19.1"
constraints = ">= 5.0.0, < 5.20.0"
hashes = [
"h1:HkKPMZ/n+QiExkRUSLjGMTGnuIaph+k932LiTp7CKZM=",
"h1:LicdZu3hugYpWuCAprg2EslbVP0zANnV9n9/2KiOnYc=",
"h1:XYVRvCG+auhkY1NnSe6pK7ClqKW5GX8BgUnMQwfC7mQ=",
"h1:Xf1PHfUfK690caJYZvoudKKBppfleJ6RcqsEQWqKVCw=",
"h1:mopYISyLkUVUwMjJbuPenxIUVDrna1/7ACB1hfMfciU=",
"zh:0651618000db705564dab5a25322b9d76ea54b7dd78931ed3565497b559babeb",
"zh:1a7847e9479fb6d21a65ef933ffae1416b1e4b44ca940c0d6c50fc4248cc4a0d",
"zh:5597cee5854131045eb9f201ae3a70b59c51955d31a647d9616863c746d902cb",
"zh:580786830d93e35b957754fd4c62d4681a3b19abc28b757e41acba26455663b1",
"zh:83c4bdfb0e74fd50e56fff3c461d76c1c1ec61af3f679e4de1aa70b5ed05a09f",
"zh:abb4d1052cee61d80f9cb51e5421e3c118312403afb7104b98bd7e310ac736ee",
"zh:b0aeeb3d66ea4d719989875e778c477065ba941e3a76e9a8caacc3be08208dd9",
"zh:e43b4b2dfcec1ce2115f5a5c86042d432deb49bee8eae103eb56d97ea02e2e3b",
"zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32",
]
}
provider "registry.opentofu.org/grafana/grafana" {
version = "3.25.9"
constraints = "~> 3.0, ~> 3.22"
hashes = [
"h1:5fXaauPL+gsUJAtGiPebhvPors/QNB1NYKK5wiLDGjM=",
"h1:Mr94xUwSKxLJxWxd/zed2K2xb57zE/+18uhIuo5/k44=",
"h1:ddQjGuxcMvrxB2bHBgC5SHI+ueo7KvnZhNRW/5+Nnh4=",
"h1:m19AUS7s6DUOawfYD4OSEXVqxjp7OG/i8ArjcxCDIW0=",
"h1:nNGW1JcrxYZeWO0uKDC6EGvIeKFUb6MZQpIViEtwnD4=",
"zh:052dd83cbf794d6a0c41ef6262286063d64c7b2107f3a6b1b81e679303072759",
"zh:117092dfc73619621eb48046934ef14c09e4419fc6d5bab35bff7549eac905fb",
"zh:153952d2f01812cada014905852c8a03fb68a204b98a533b81830e923bf69848",
"zh:16e9ada001398329ebe0c28be26cb3b71d8a30bd4cc41aa94ec182d671a06b58",
"zh:1eab3a56da8bb9478b0b32e87c3210b82d937d6a9586bd64046840f48486f7a1",
"zh:2e92818816fbac9e52a00d7c2c94b529b2fccdcfcd712c0fef8f4b340658c6ad",
"zh:3518f1973b3942ef380574a6765835204970f39c635b7e1dacde5e2c6a9abf16",
"zh:3ec8c054b91d44cb103ec82484e0974360ad9d4167e035cbfba0c858613f46f1",
"zh:418418c9d9e3e30e6e065d00956c56f78873546ad2c7d52a5fddb3ead207f4f7",
"zh:50009c4adbfe2174984f9c80627eb37c629b2b756acfd79f09b6dde7c6e58c60",
"zh:5482ea23403676f691d765d644519cbb632b1b5c1cfa6f3115705a0512d7d2db",
"zh:55b45e72ff7f186f91e3134eb925718b1e7b3e32aa5c810888f6be1db7242cf4",
"zh:577cc62c2e5e2b6c9eda49c316931318f106b7cbf2f59727d20a16c8a1902637",
"zh:63d43991044566879304f153ef3a1ae50cc4301508888a230462259aac97c7a2",
"zh:76074d9d200c59c707f570603b7b447b48d38ce57b53b54ee921c45b6521d816",
"zh:81141dd99b77fd091f1bd86fff15e6a25abfd92c825e77439457a6eba027f27c",
"zh:a3db02539d1417e326cee4e70ed77bce37bc4586f98b7067a0653e7b608d0cc9",
"zh:a53a7c400f3d8cef527897a95bd4e559e306703706d1dae509963d42423ef006",
"zh:d6b4f270ea3a27542fea8af45323428452563191929e13d3d92a64365dca1694",
"zh:fffaf801f26a13d5a600d6f39f508e7c07ed09e7dd35fc3541d8066236348b6f",
]
}
provider "registry.opentofu.org/hashicorp/null" {
version = "3.3.0"
hashes = [
"h1:0r7+t8CqzjfBgHgEiJGBCw+McEUdRXliMdF+Hk29d8o=",
"h1:EvvCOc4FJY3NitSm6BpzCcUPU53LayVCB/tPOxYmy7U=",
"h1:JofS1og3hPN0ANjH+gNjxrJyyk6znodpC/F0qhp4eEk=",
"h1:eODLdk/pARc4yxChAFtwseVmBr+r5fF9yGOvUhwGEyM=",
"h1:mdu+qpyVmjDDLMrcL1JFy+cSyF58I3TFJwB5NssCZ58=",
"zh:083dcc0bec53f8abfa3f2aa2ce9d732a9675338fd60ae7d61162e25db7cb08bf",
"zh:19f7456b5a2ad16595860974714bfdb25b87bc16356ea9d5c7453892aaa27864",
"zh:222c0ed1fed4e4c677ebe626104dbfdba66763e264de0d9c27c58ce60104ee69",
"zh:271711d6caa7dd5a4e9b79fe8c679fab61a840bcf80040a0f5ebb425d1b27d97",
"zh:5adcf35f30baaea13f80c2a2c774deb9369892719493049687e23476c9dff40f",
"zh:5bcfd19df16e73d7f0ad75bd09e2b3b86cf6700d09822d585d68304b71de1d97",
"zh:604edecf263e38674decb35bb4e0e048fdc951f26fa103c33065ff9728f0313b",
"zh:782acbfb4fa4807e273e588fe45b4aaea9dd0fd1136f76ec3200f6f4db3af8d6",
"zh:84411a596d528fe67294e5c1cfd0c2036b08802497bcc4215ce518924f3c9a4a",
"zh:85e79eecf3f5348975cffec3016b0eba3baf605646102d4348796ccd2df2e5f6",
"zh:95669535ca17aeefef307ebfd59ce6930953173baae5637e8cbbf0297ec7ad58",
"zh:d04d9b177747bfd66b4a45b5d911a2a7822aa8451f5e35621971fb7a4206b530",
"zh:e6d9c924475283e90833450a14a732f4deb6d9bb131db8f86ab856e894270836",
"zh:ebcab0c8a1334c86ed7cfa53f571a17ad6d27e9901f27a8854ea622a74b54bb6",
"zh:ef9c757bb2c83d2103811a3d86b6ec5be06b0ffc337b84db1582d023bce7cdcd",
]
}
provider "registry.opentofu.org/hashicorp/random" {
version = "3.9.0"
constraints = "~> 3.0"
hashes = [
"h1:8EQU5KSxezcjo/phRSe69rDOI0lk4pSaggj7FsskYp8=",
"h1:U8KXqGCoNI9/guYbTvzgdtVk3fRthoG0UXwm1JoEpIs=",
"h1:gGDdPPibmw2EWROx+sh1RGLjR5+nPwZyrf6/N9jXfeM=",
"h1:ig2s1IS9IzehorRjvVAnKIsUUj8fkgyxct1L/kswcc4=",
"h1:j3lS+ZEERFnoab8t1ppDrScGVP/cgWbzlCrEYKTCXYw=",
"zh:03f1114cc20b8913523735ab76e0f0a2b16ce13c92923a53304bf85f07fc0dbc",
"zh:105b678ee72322a3067f105d7e05e940f6143238f377f6e87ff4ec909246ac2a",
"zh:55f3bbf13ea18cbace61a706566a80f25f33fe2b1780b6f3d7b582af2a05b6d2",
"zh:63adf996db48f082f7a6351eb485e219cd88795fc71e6ec60a837263ab0d2cb1",
"zh:7e99550738a4e3cc68b8a467714b0d69371025fe95e3326d5323d026d55653e9",
"zh:8342b54af3a18a37e075eeae61be57f4de2ba71b35d95c5075d402dd2c1f289d",
"zh:83ee18e32ac9dd5fc91298554b7c4cfa4c3a1db50f4c797945637cc93c0844ae",
"zh:993ecc0adbf6bd535a59fbc9b735d8c33950e6f6eb5e621d750da9b71d65d80a",
"zh:ad722bc59d4edbf1415e827fc007c0efe6e0e9462d5568bae20b34be1058a261",
"zh:ae9448e1f87b2f9a6c5197a0e9862162ec6b137cb3a3835e11522995d8939e7c",
"zh:bc9cdd3aac784f759125c6627f6f6416e8726a1c184eb9cf3e55b9edbc94c627",
"zh:c8e35b89572ba1c40a9b20022e033a3395fb8d42e7604d50c900f193ba10382e",
"zh:e2deaa8a9975ef81d9f62baed12c41286918b0a10908e0e031f13f69a3b730a1",
"zh:ee39707557210a0ab1098aa357d2cdfe502e5a312d0dbdffb09d08facc4d3fc5",
"zh:f81afe4eb63e8aa9e0ea71be6c990f0dc69cb360e7191c0742a991f4a5081b64",
]
}
@@ -5,7 +5,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5"
version = ">= 5, < 5.20.0"
}
random = {
source = "hashicorp/random"
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# Verifies that every OpenTofu/Terraform root module which declares a
# `required_providers` block has a committed `.terraform.lock.hcl`.
#
# Without a committed lock file, provider versions are not pinned: each
# `tofu init` in a clean checkout (e.g. CI) resolves the version constraint to
# the newest matching release, so a module can silently jump provider versions
# without anyone explicitly upgrading it. The lock file freezes the exact
# versions (and checksums) instead.
#
# Run locally: ./deployment/scripts/check-lock-files.sh (or: mise run tf:check-locks)
# Runs in CI as part of the Test workflow.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
# Modules are identified by a tracked .tf file containing a required_providers
# block. Using `git grep` (tracked files only) avoids matching the throwaway
# copies under .terraform/ and .terragrunt-cache/.
mapfile -t modules < <(git grep -l 'required_providers' -- 'deployment' \
| grep '\.tf$' \
| xargs -r -n1 dirname \
| sort -u)
if [ "${#modules[@]}" -eq 0 ]; then
echo "No Terraform modules with required_providers found." >&2
exit 0
fi
missing=0
for dir in "${modules[@]}"; do
lock="$dir/.terraform.lock.hcl"
if ! git ls-files --error-unmatch "$lock" >/dev/null 2>&1; then
echo "::error file=$dir/config.tf::Missing committed lock file: $lock"
missing=1
elif ! grep -q 'provider "' "$lock"; then
echo "::error file=$lock::Lock file has no provider entries: $lock"
missing=1
else
echo "ok: $lock"
fi
done
if [ "$missing" -ne 0 ]; then
cat >&2 <<'EOF'
One or more modules are missing a committed .terraform.lock.hcl.
Generate it from the module directory with:
tofu init -backend=false
tofu providers lock \
-platform=linux_amd64 -platform=linux_arm64 \
-platform=darwin_amd64 -platform=darwin_arm64 -platform=windows_amd64
rm -rf .terraform
Then commit the generated .terraform.lock.hcl.
EOF
exit 1
fi
echo "All Terraform modules have a committed lock file."