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

Add support for test environment variables #1285

Merged
merged 20 commits into from
Apr 22, 2024
Merged

Conversation

aaabdelgany
Copy link
Contributor

@aaabdelgany aaabdelgany commented Mar 12, 2024

Description

This PR adds support for test environment variables to the tfe-provider. It does so in a separate tfe_test_variable as opposed to adding this to the tfe_variable resource. The tfe_variable resource currently supports workspace level variables and variable set level variables and parses HCL to determine which it's using. A new tfe_test specific variable was implemented to not contribute further to the complexity of the tfe_variable resource as well as to maintain the simplicity of the tfe_test_variable resource.
Remember to:

Testing plan

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

TF_ACC=1 TF_LOG_SDK_PROTO=OFF go test $(go list ./... |grep -v 'vendor') -v -run TestAccTFETestVariable -timeout 15m
?   	github.com/hashicorp/terraform-provider-tfe	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/client	0.164s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/logging	0.249s [no tests to run]
?   	github.com/hashicorp/terraform-provider-tfe/version	[no test files]
=== RUN   TestAccTFETestVariable_basic
--- PASS: TestAccTFETestVariable_basic (15.09s)
=== RUN   TestAccTFETestVariable_update
--- PASS: TestAccTFETestVariable_update (14.61s)
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/provider	30.198s
...

@aaabdelgany aaabdelgany marked this pull request as ready for review March 14, 2024 14:07
@aaabdelgany aaabdelgany requested a review from a team as a code owner March 14, 2024 14:07
@brandonc
Copy link
Collaborator

brandonc commented Mar 19, 2024

Would you mind adding some docs for this resource to the website/docs/r directory? It would help our reviewing considerably. I also noticed a couple of things outright: is the resource importable? In the schema, organization is defined as optional but seems to be treated as required. See the other provider_next resources for proper org schema handling, because it may also come from the default defined in the provider config.

@aaabdelgany
Copy link
Contributor Author

Would you mind adding some docs for this resource to the website/docs/r directory? It would help our reviewing considerably. I also noticed a couple of things outright: is the resource importable? In the schema, organization is defined as optional but seems to be treated as required. See the other provider_next resources for proper org schema handling, because it may also come from the default defined in the provider config.

The resource is not importable at this time - but that may change if a good use case for it arises. I've updated the required fields in the schema and added documentation. Please let me know if theres anything else I can do to facilitate the review process.

@aaabdelgany aaabdelgany requested review from ggambetti and a team April 12, 2024 14:45
Copy link
Member

@ggambetti ggambetti left a comment

Choose a reason for hiding this comment

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

I'm not super familiar with provider code, and so the review is mostly questions. 😅

Copy link
Member

@ggambetti ggambetti left a comment

Choose a reason for hiding this comment

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

👍🏻

@aaabdelgany aaabdelgany merged commit 0706390 into main Apr 22, 2024
9 checks passed
@aaabdelgany aaabdelgany deleted the abdu/add_test_env_vars branch April 22, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants