Skip to content

Add init-time policy evaluation#38519

Draft
dsa0x wants to merge 8 commits into
mainfrom
policy-pr5-init-policy
Draft

Add init-time policy evaluation#38519
dsa0x wants to merge 8 commits into
mainfrom
policy-pr5-init-policy

Conversation

@dsa0x
Copy link
Copy Markdown
Member

@dsa0x dsa0x commented May 5, 2026

This is part of a stacked series to upstream the policy work in smaller, reviewable pieces:

This PR adds policy evaluation during terraform init. That includes evaluating policy during module installation and provider installation, wiring the init flow through the policy client, and adding the init-specific view/test support needed to surface policy outcomes correctly in that stage of execution.

Contrary to the plan/apply workflow, policy failures during init would result in a non-zero exit of the terraform command.

Included here

  • init-time module policy evaluation
  • init-time provider installation policy evaluation
  • initwd hook changes needed to support policy checks during module installation
  • init command wiring
  • init-specific view support for policy results
  • init-specific tests

Target Release

1.16.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Changelog Warning

Currently this PR would target a v1.16 release. Please add a changelog entry for in the .changes/v1.16 folder, or discuss which release you'd like to target with your reviewer. If you believe this change does not need a changelog entry, please add the 'no-changelog-needed' label.

@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 3b37dea to 20ce6af Compare May 5, 2026 09:52
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from 943bd66 to 49366dd Compare May 5, 2026 10:18
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 20ce6af to 0cd9be4 Compare May 5, 2026 10:22
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from 49366dd to 93f20ff Compare May 5, 2026 10:32
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 0cd9be4 to a60d49a Compare May 5, 2026 10:33
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from 93f20ff to 33b149a Compare May 5, 2026 12:00
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from a60d49a to 01c69f8 Compare May 5, 2026 12:07
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from 33b149a to 11ca31f Compare May 15, 2026 12:41
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 01c69f8 to 1bbda0b Compare May 15, 2026 12:51
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch 3 times, most recently from 6a83b13 to bf0f7d9 Compare May 27, 2026 07:04
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch 7 times, most recently from ceca9d8 to f6cce9a Compare May 28, 2026 09:28
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from bf0f7d9 to 38b1a14 Compare May 29, 2026 15:19
Copy link
Copy Markdown
Member

@SarahFrench SarahFrench left a comment

Choose a reason for hiding this comment

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

I jumped ahead a bit. but I took a glance at this PR and realised I could give some feedback that might be useful if you're blocked while other PRs are under review.

To be explicit, I'm planning to continue focusing on the earliest PR that's open for review out of the stack, so I may not follow up here again until we reach this PR's review.

Comment thread internal/command/arguments/init.go Outdated
Comment thread internal/command/arguments/init.go
Comment thread internal/command/query.go Outdated
Comment thread internal/command/format/diagnostic.go Outdated
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from 38b1a14 to a9e8fca Compare June 1, 2026 11:36
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from f6cce9a to abe1c41 Compare June 1, 2026 18:53
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from f144183 to af50d84 Compare June 2, 2026 07:25
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch 2 times, most recently from fcb3f12 to 6c5df78 Compare June 2, 2026 10:14
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch 2 times, most recently from 27f16d4 to a11fa35 Compare June 3, 2026 11:26
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 6c5df78 to 556920d Compare June 3, 2026 11:28
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from a11fa35 to 7dd9e87 Compare June 3, 2026 12:01
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 137d602 to cc2ed92 Compare June 3, 2026 12:04
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch 2 times, most recently from 8b6d17f to de767e7 Compare June 3, 2026 13:11
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from cc2ed92 to 1b55da5 Compare June 3, 2026 13:11
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from e0cdbb3 to 4405313 Compare June 3, 2026 17:40
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch 4 times, most recently from 772e969 to 30cd8da Compare June 4, 2026 07:30
@dsa0x dsa0x force-pushed the policy-pr4-cli-backend branch from d7066be to d192685 Compare June 4, 2026 14:09
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 30cd8da to 3d0811b Compare June 5, 2026 05:50
Base automatically changed from policy-pr4-cli-backend to main June 5, 2026 13:53
@dsa0x dsa0x force-pushed the policy-pr5-init-policy branch from 3d0811b to 7155955 Compare June 5, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants