Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: allow using global variables in suite-level variable definitions #34699

Merged
merged 14 commits into from
Feb 23, 2024

Conversation

DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Feb 19, 2024

This allows practitioners to define variables in .tfvar files, environment variables, CLI flags and use them in the definition of suit-level variables in the top-level variables block.

Fixes #34534
Fixes #34538

Target Release

1.8.x

Draft CHANGELOG entry

ENHANCEMENTS

  • test: allow using global variables in suite-level variable definitions

Copy link
Member

@liamcervante liamcervante left a comment

Choose a reason for hiding this comment

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

Given that we do need to know about the type I don't know what I intended to say here.

internal/backend/local/test.go Outdated Show resolved Hide resolved
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from 17d9205 to e573680 Compare February 22, 2024 17:30
@DanielMSchmidt DanielMSchmidt marked this pull request as ready for review February 23, 2024 10:45
Copy link
Member

@liamcervante liamcervante left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple of small things around naming and tidying up.

Generally a "TestSuite" refers to all the test files currently being executed not just the current test file, so there's a couple of places where I think we should change names and comments to reflect that.

Thanks!

internal/backend/local/test.go Outdated Show resolved Hide resolved
internal/backend/local/test.go Outdated Show resolved Hide resolved
internal/backend/local/test.go Outdated Show resolved Hide resolved
website/docs/language/tests/index.mdx Outdated Show resolved Hide resolved
internal/moduletest/hcl/provider.go Outdated Show resolved Hide resolved
@liamcervante
Copy link
Member

Just a note on the changelog entry. I usually start with the full command, so something like:

  • terraform test: File-level variables can now reference global variables.

Or something like that.

@DanielMSchmidt DanielMSchmidt merged commit 8564e93 into main Feb 23, 2024
7 checks passed
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@DanielMSchmidt DanielMSchmidt deleted the terraform-test-use-vars-within-blocks branch February 23, 2024 13:19
Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants