From 519c5214a52b9c0ef8136be94e5a3ef435962660 Mon Sep 17 00:00:00 2001 From: Tom Watt Date: Mon, 16 Dec 2024 11:48:35 +0000 Subject: [PATCH] feat: add warning when creating a cluster queue with "dispatch_paused = true" Signed-off-by: Tom Watt --- buildkite/resource_cluster_queue.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/buildkite/resource_cluster_queue.go b/buildkite/resource_cluster_queue.go index 0e8eec51..3b439416 100644 --- a/buildkite/resource_cluster_queue.go +++ b/buildkite/resource_cluster_queue.go @@ -146,8 +146,15 @@ func (cq *clusterQueueResource) Create(ctx context.Context, req resource.CreateR state.ClusterUuid = types.StringValue(r.ClusterQueueCreate.ClusterQueue.Cluster.Uuid) state.Key = types.StringValue(r.ClusterQueueCreate.ClusterQueue.Key) state.Description = types.StringPointerValue(r.ClusterQueueCreate.ClusterQueue.Description) - state.DispatchPaused = plan.DispatchPaused + // GraphQL API does not allow Cluster Queue to be created with Dispatch Paused + if plan.DispatchPaused.ValueBool() { + resp.Diagnostics.AddWarning( + "Cluster Queue cannot be created with Dispatch Paused", + "Setting dispatch_paused in State to 'true' but requires re-run of Apply", + ) + } + state.DispatchPaused = plan.DispatchPaused resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) }