Skip to content

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

Merged
DanielMSchmidt merged 14 commits intomainfrom
terraform-test-use-vars-within-blocks
Feb 23, 2024
Merged

test: allow using global variables in suite-level variable definitions#34699
DanielMSchmidt merged 14 commits intomainfrom
terraform-test-use-vars-within-blocks

Conversation

@DanielMSchmidt
Copy link
Copy Markdown
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

@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from b76481b to ae5f847 Compare February 20, 2024 09:45
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from ae5f847 to ef36fc0 Compare February 20, 2024 12:22
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from ef36fc0 to 383d010 Compare February 20, 2024 14:49
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from 383d010 to 7ae7a20 Compare February 20, 2024 15:40
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from 9896221 to 42c478c Compare February 21, 2024 11:06
Copy link
Copy Markdown
Contributor

@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.

@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from 61f5aa0 to df3ee21 Compare February 21, 2024 19:09
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from 17d9205 to e573680 Compare February 22, 2024 17:30
@DanielMSchmidt DanielMSchmidt force-pushed the terraform-test-use-vars-within-blocks branch from ed2a331 to ea0856b Compare February 23, 2024 10:39
@DanielMSchmidt DanielMSchmidt marked this pull request as ready for review February 23, 2024 10:45
Copy link
Copy Markdown
Contributor

@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!

@liamcervante
Copy link
Copy Markdown
Contributor

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
@github-actions
Copy link
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
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