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

fix(creds): allow periods in TF_TOKEN_... credentials vars #30878

Merged
merged 1 commit into from
Apr 15, 2022

Conversation

brandonc
Copy link
Contributor

After re-reviewing terraform-credentials-env, I made a mistake in not allowing period characters in TF_TOKEN_... variable names, nor allowing case-insensitive variable names. I now see that being liberal with variable names by using svchost.ForComparison on the variable name itself can allow for all these variations without a bunch of guessing code. I should have just lifted @apparentlymart 's code to begin with!

The only addition I made was to encode hyphens as double underscores. My reasoning about why this is OK is captured in the comment:

We accept double underscores in place of hyphens because hyphens are not valid identifiers in most shells and are therefore hard to set. This is unambiguous with replacing single underscores below because hyphens are not allowed at the beginning or end of a label and therefore odd numbers of underscores will not appear together in a valid variable name.

Can you double check my logic there?

I also revised the docs accordingly @laurapacilio

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me!

I left an inline note about a dangling comment that I expect was probably just a TODO you forgot to remove after you TODID it 😀

internal/command/cliconfig/credentials.go Outdated Show resolved Hide resolved
@brandonc brandonc merged commit 173e21a into main Apr 15, 2022
@brandonc brandonc deleted the brandonc/periods_env_creds branch April 15, 2022 20:40
@github-actions
Copy link

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

@github-actions
Copy link

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 May 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants