From 4059502a6cb920772ee654dbb45bf860d5fd202e Mon Sep 17 00:00:00 2001 From: Michael Lin Date: Fri, 25 Nov 2022 20:58:10 -0800 Subject: [PATCH] fix: add completed tfc pending states --- .../cli-core/src/lib/models/terraform-cloud.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/@cdktf/cli-core/src/lib/models/terraform-cloud.ts b/packages/@cdktf/cli-core/src/lib/models/terraform-cloud.ts index 407dfa51fd..4663c6d7ab 100644 --- a/packages/@cdktf/cli-core/src/lib/models/terraform-cloud.ts +++ b/packages/@cdktf/cli-core/src/lib/models/terraform-cloud.ts @@ -356,12 +356,25 @@ export class TerraformCloud implements Terraform { const url = `https://${this.hostname}/app/${this.organizationName}/workspaces/${this.workspaceName}/runs/${result.id}`; sendLog(`Created speculative Terraform Cloud run: ${url}`); + // the source of truth of all pending states are from + // https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#run-states + // any state before `apply_queued` is considered pending unless it is specified as a final state const pendingStates = [ "pending", + "fetching", + "fetching_completed", + "pre_plan_running", + "pre_plan_completed", + "queuing", "plan_queued", "planning", "cost_estimating", + "cost_estimated", "policy_checking", + "policy_override", + "policy_checked", + "post_plan_running", + "post_plan_completed", ]; while (pendingStates.includes(result.attributes.status)) {