Skip to content

fix: allow init cmd to pull vars from cloud#38579

Draft
ctrombley wants to merge 1 commit into
mainfrom
ctrombley/cloud-vars-during-init
Draft

fix: allow init cmd to pull vars from cloud#38579
ctrombley wants to merge 1 commit into
mainfrom
ctrombley/cloud-vars-during-init

Conversation

@ctrombley
Copy link
Copy Markdown
Contributor

@ctrombley ctrombley commented May 13, 2026

DO NOT MERGE

Terraform 1.15.0-beta2 is able to resolve dynamic module sources in config using variables.

When a new config is created with a cloud block, terraform init needs to be run to generate the lock file that will resolve the dynamic module sources. If a dynamic module source has been used, the resolved module source is based on the variable values passed. Currently, the only way to pass values locally is via -vars or -var-file (both now supported by the init command).

But since the cloud block already references a workspace, terraform should also be able to resolve hcpt or tfe variables from that workspace to use as context when resolving the module sources.

AC: We should pull the workspace vars from hcpt/tfe during init when a variable has been defined in config but doesn't have values passed via -vars or var-file.

@ctrombley ctrombley self-assigned this May 13, 2026
@ctrombley ctrombley added the cloud Related to Terraform Cloud's integration with Terraform label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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.

@ctrombley ctrombley force-pushed the ctrombley/cloud-vars-during-init branch from a07f815 to b752ec7 Compare May 13, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cloud Related to Terraform Cloud's integration with Terraform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant