-
Notifications
You must be signed in to change notification settings - Fork 156
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
d/tfe_project: Output workspace names #1429
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a reasonable change but I want to point out that there is a subtle drawback to having two "Set" type attributes side-by-side like this: if you convert it to a list, the indices may or may not correspond to each other. In other words, tolist(data.tfe_project.this.workspace_ids)[0]
may or may not correspond to tolist(data.tfe_project.this.workspace_names)[0]
and so it seems to me like the symmetry suggested by the attributes could introduce some unintended bugs downstream.
It may be acceptable to highlight in the docs that the attributes are sets and cannot be meaningfully mapped to each other... Unless you can think of a better design. I thought about several solutions but nothing really jumped out at me as being obviously better. |
Also, can you add a test assertion to |
Thanks for the feedback @brandonc ! Yeah, I'm with you - I'd love to be able to tie them together, but I couldn't come up with a good way to do so. I've added a test assertion and a note in the docs, let me know if you need any additional changes! Acceptance tests w/ additional assertion:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHANGELOG Just needs a rebase and I'll be glad to merge it
@@ -9,6 +9,8 @@ Get information on a Project. | |||
|
|||
Use this data source to get information about a project. | |||
|
|||
~> **NOTE:** The `workspace_ids` and `workspace_names` attributes are not guaranteed to return values in the same order, so they cannot be reliably mapped to one another. To map workspace names to IDs reliably, it is recommended to pass those names into the `tfe_workspace_ids` data source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
This PR is to emit the names of all the workspaces within a project. My use case is is follows:
So, this allows me to capture the workspace names within a project and act on them. If there is a better alternative, let me know!
Remember to:
Testing plan
foo
tfe_project
data source with namefoo
, e.g.:terraform plan
/terraform apply
workspace_names
in addition to the attributes that were already there.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.