From e49088b38342ec1a985eeab9243a2e811b325a11 Mon Sep 17 00:00:00 2001 From: Dmitriy Sirant Date: Thu, 29 Oct 2026 10:13:25 +1000 Subject: [PATCH] fix: Create protected environments after project group shares GitLab accepts a group in an environment's deploy access levels or approval rules only when the group is shared on the project itself, and drops it otherwise. When an apply shared a group and protected an environment for it at once, the environment POST could run first and fail with "Deploy access levels is too short (minimum is 1 character)". Co-Authored-By: Claude Opus 5.5 --- main.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.tf b/main.tf index 22ffdae..660d358 100644 --- a/main.tf +++ b/main.tf @@ -1250,6 +1250,11 @@ resource "gitlab_project_protected_environment" "this" { } ] ]) + + # GitLab accepts a group in deploy access levels or approval rules only once it is + # shared on the project itself, and silently drops it otherwise. Created in parallel + # with the share, the environment failed with "Deploy access levels is too short". + depends_on = [gitlab_project_share_group.this] } resource "gitlab_project_runner_enablement" "this" {