fix: emit drift metadata block on plan parse errors#144
Merged
Kevin (kevcube) merged 1 commit intoJul 2, 2026
Merged
Conversation
Append `{{template "metadata" .}}` to the `when_parse_error`
issue-markdown output so "Failure Detected" issues created from early
failures (e.g. OIDC/AWS auth timeouts) carry the json metadata block.
Without it the drift-detection reconcile action cannot match the issue
to a component and never auto-closes it once the component recovers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AleksandrMatveev
requested review from
Joe Niland (joe-niland) and
Kevin (kevcube)
July 2, 2026 01:27
There was a problem hiding this comment.
Pull request overview
This PR ensures drift-detection “Failure Detected” GitHub issues include the hidden JSON metadata block even when Terraform/atmos fails early (plan parse errors), allowing the companion drift-detection action to reliably match and auto-close recovered components.
Changes:
- Appends
{{template "metadata" .}}to thewhen_parse_errordrift-mode issue markdown branch inconfig/summary.yaml.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Kevin (kevcube)
approved these changes
Jul 2, 2026
Kevin (kevcube)
left a comment
Member
There was a problem hiding this comment.
LGTM makes sense to me.
Member
|
Thanks for the contribution AleksandrMatveev s |
Changes Found for
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
{{template "metadata" .}}to thewhen_parse_errorbranch of the drift-detection issue markdown inconfig/summary.yaml.jsonmetadata block present on failure issues that originate from a Terraform/atmos parse error, not just on successful/drift plans.why
cloudposse/github-action-atmos-terraform-drift-detectionaction only reconciles issues whose body contains a parseable```jsonmetadata block — it derives its matching key (<stack>-<component>) from that block and filters out any issue wheregetMetadataFromIssueBody(body)returnsnull.terraform.plan.templatealready appends{{template "metadata" .}}to its issue section, but thewhen_parse_errortemplate (used when Terraform/atmos fails before producing a parseable plan — e.g. an OIDC/cloud-auth timeout or other early/network error) did not.metadatatemplate (component,stack,componentPath,commitSHA) are already passed totfcmtin both invocations, so they render correctly in the parse-error path. The change is a single line and does not affect the non-drift (PR comment) output.references
cloudposse/github-action-atmos-terraform-drift-detection—src/action.js(mapOpenGitHubIssuesToComponents) andsrc/models/stacks_from_issues.js(getMetadataFromIssueBody).