-
Notifications
You must be signed in to change notification settings - Fork 10k
Make Terraform reject empty strings as invalid workspace names #37267
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
Conversation
Opening this for review, Their response would inform a wider discussion I think needs to be had in this PR: is adding this validation something we'd consider a breaking change, and therefore something that we'd not want to merge? |
The situation with the AzureRM backend is slightly weird but mostly good in the context of this PR. I was able to go through
I'm unsure why the backend uses file suffixes with colons as a way to separate workspaces but for the purpose of this test I just accept that design decision. 🤷🏻♂️ The "good" part is that while
Relatedly, running TL;DR while creation of workspace called Therefore I would conclude that the validation/rejection on Core side is net positive for Azure users as it avoids the confusing UX. |
I've seen the same behaviour when testing the I performed an
After However an empty state was made as a consequence of the
When I deleted the
|
I think given we've seen that the Edit: @radeksimko I've requested you as a reviewer as you've got context. |
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. |
Handling a workspace called
""
is currently disallowed due to how individual backends are implemented. This PR formalises making this an invalid thing for a user to do by changing validation logic to reject""
as a workspace name. This validation logic is currently used interraform workspace select
andterraform workspace new
commands.Relevant info
Some backends explicitly block
""
Here is code where backend implementations block
""
at the point of calling code trying to obtain a state manager for a given workspace name:""
triggers amissing state name
error""
triggers ais not a valid state name
error""
triggers amissing state name
errorSome backends don't block
""
Before opening this for review I'm going to ask around about whether an empty string could be valid for some backends. My hunch is that this is just missing validation, but I want to confirm.
Workspace
""
can be equivalent to workspace"default"
For some backend the
""
workspace is handled like the"default"
workspace. For example, the local backend creates state in the default location when the""
workspace is selected.Target Release
1.13.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry