From 76ee5b703137fe54cd7a2e232b5491bd469e9cd8 Mon Sep 17 00:00:00 2001 From: Antoine Rouaze Date: Thu, 4 Jan 2024 14:36:25 -0500 Subject: [PATCH] fix: Swap error messages in validateAgentExecution The message "agent_pool_id must be provided when execution_mode is 'agent'" was displayed when the execution mode was remote, and the agent pool ID was set, which was confusing. --- internal/provider/resource_tfe_workspace.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/resource_tfe_workspace.go b/internal/provider/resource_tfe_workspace.go index 435d15ed4..f9a047edf 100644 --- a/internal/provider/resource_tfe_workspace.go +++ b/internal/provider/resource_tfe_workspace.go @@ -903,9 +903,9 @@ func validateAgentExecution(_ context.Context, d *schema.ResourceDiff) error { if executionModeSet { executionModeIsAgent := executionMode.AsString() == "agent" if executionModeIsAgent && !agentPoolIDSet { - return fmt.Errorf("execution_mode must be set to 'agent' to assign agent_pool_id") - } else if !executionModeIsAgent && agentPoolIDSet { return fmt.Errorf("agent_pool_id must be provided when execution_mode is 'agent'") + } else if !executionModeIsAgent && agentPoolIDSet { + return fmt.Errorf("execution_mode must be set to 'agent' to assign agent_pool_id") } }