Skip to content

Record terraform run result metadata#1094

Merged
liyu-ma merged 5 commits intomainfrom
maliyu/add-terraform-action-result
Mar 12, 2026
Merged

Record terraform run result metadata#1094
liyu-ma merged 5 commits intomainfrom
maliyu/add-terraform-action-result

Conversation

@liyu-ma
Copy link
Contributor

@liyu-ma liyu-ma commented Mar 6, 2026

Context

We want to record terraform action success/failure or timeout error for stats purpose. Add logic to scan terraform logs to capture those info.

Change

  • Add a new field result to terraform execution metadata record two flags "success": true/false and "timed_out": true/false }
  • Improve the code so time elapsed can be captured even when the terraform action failed.
  • Update terraform azapi timeout to 60 mins, and corresponding pipeline timeout to 2hr

See result field appended:
image

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a result field to each Terraform execution metadata record (mapped to a result dynamic-type column in the terraform_metadata_main table) and fixes a gap where elapsed time was not recorded when a Terraform action failed mid-run. The fallback mechanism scrapes Still creating/destroying... log lines to capture the last known elapsed time when no completion line is found.

Changes:

  • Added COMPLETE_PATTERN (renamed from PATTERN), START_PATTERN, and ELAPSED_PATTERN regex constants to classify Terraform log lines.
  • Extracted record-building into a build_result() helper that includes the new result: { success: bool } field.
  • Modified process_terraform_logs to track in-progress state and emit a failure record (with success: false) when no completion line is found.

@liyu-ma liyu-ma force-pushed the maliyu/add-terraform-action-result branch from e8dae1a to 7eec062 Compare March 8, 2026 06:36
@liyu-ma liyu-ma force-pushed the maliyu/add-terraform-action-result branch from 7eec062 to 48bafbb Compare March 11, 2026 03:27
@liyu-ma liyu-ma force-pushed the maliyu/add-terraform-action-result branch from 48bafbb to a0a3dd1 Compare March 11, 2026 03:46
@liyu-ma liyu-ma force-pushed the maliyu/add-terraform-action-result branch from 9e6d413 to b3c2e03 Compare March 11, 2026 05:53
@liyu-ma liyu-ma merged commit a9582b4 into main Mar 12, 2026
60 checks passed
@liyu-ma liyu-ma deleted the maliyu/add-terraform-action-result branch March 12, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants