From f779ea30a6a1e9f1cee10e37398e436d58e1197f Mon Sep 17 00:00:00 2001 From: Gregoire Date: Thu, 16 Jul 2026 02:01:04 +0200 Subject: [PATCH] fix(github): add missing depends_on between labels and repository Fresh repo creation raced label creation against the GitHub API's propagation delay -- 9 of 17 labels for dd-toolkit failed with '404 Not Found' because each.value.repository is a plain string, giving Terraform no dependency edge to the repository module. Existing repos never hit this since their labels already exist (no-op diff). Signed-off-by: Gregoire --- terraform/github/labels.tf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/terraform/github/labels.tf b/terraform/github/labels.tf index 21144f7..db1ba0b 100644 --- a/terraform/github/labels.tf +++ b/terraform/github/labels.tf @@ -1,6 +1,17 @@ resource "github_issue_label" "standard" { for_each = local.repo_labels + # each.value.repository is a plain string (repo name), not a reference to + # module.repository — without this explicit depends_on, Terraform has no + # graph edge between the two and may schedule label creation in parallel + # with a brand-new repository's own creation. Observed in practice: 9 of + # 17 labels for a freshly-created repo failed with + # "POST .../labels: 404 Not Found" because the GitHub API hadn't finished + # propagating the new repo yet. Existing repos never hit this (their + # labels already exist, so it's a no-op diff), which is why it went + # unnoticed until the next brand-new repository. + depends_on = [module.repository] + repository = each.value.repository name = each.value.name color = each.value.color