fix(opentofu): enforce environment-gated applies - #42
Merged
Conversation
Shared Workflows CIShared workflows CI passed. View run output |
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.
Summary
Assign the reusable workflow's existing
environmentinput (defaultproduction) to the main-only OpenTofu apply job. The apply step emitsOPENTOFU_ENVIRONMENT_GATED=true; consumers can use that marker to fail closed unless the shared environment-gated apply path invoked them.Also document the caller requirement to create and protect the selected GitHub Environment before a
mainapply.Fixes #
None — owner-approved OpenTofu apply-gate repair.
Type of change
Validation
ci / lintpassed atb2e9fc3.Independent adversarial and infrastructure-security reviews found no remaining Critical/High source findings after the fail-safe marker was added. PR CI remains the validation authority.
Impact and rollout
Producer: this reusable workflow is consumed from
@mainby OpenTofu roots. After an explicitly approved merge, callers use the configured Environment (defaultproduction) for their main-only apply jobs.Manual prerequisite: each caller owner must create and protect its selected GitHub Environment with required reviewers/protection rules. Current repository-setting state is unknown and must be confirmed before any production merge/apply.
Consumer safety:
tfroot-gcphas a companion draft PR that only enables unattended apply when this workflow emits the marker. If that root were merged first, the current shared workflow omits the marker and the unattended apply fails at the interactive prompt rather than mutating production.Rollback: revert this workflow change. The companion root remains fail-closed without the marker. Use squash merge to collapse the corrective branch history.
Safety and secrets
AI-assisted change: an OpenCode agent materially produced this change. Reviewers should verify the
applyjob Environment assignment, marker scope, and unchanged PR test/plan behavior.