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

enhance: support recognizing env names from var file suffixes #2840

Merged
merged 4 commits into from Jan 25, 2024

Conversation

aliscott
Copy link
Member

@aliscott aliscott commented Jan 24, 2024

Currently we support grouping var files like prd.tfvars with prd-defaults.tfvars. This adds similar support to also group prd.tfvars with defaults-prd.tfvars.

Also for the case where we have vars called redis-prd.tfvars and redis-dev.tfvars, we still want to add them to the project if there's no other matching prd.tfvars or dev.tfvars file.

This also includes a fix to update the module loader tests since it looks like TFC registry has switched to using the commit ref instead of tag.

@aliscott aliscott self-assigned this Jan 24, 2024
@aliscott aliscott force-pushed the auto-detect-support-env-name-suffix branch from 702094c to df8382d Compare January 24, 2024 11:52
@aliscott aliscott marked this pull request as ready for review January 24, 2024 12:21
@aliscott aliscott requested a review from hugorut January 24, 2024 12:21
@aliscott aliscott marked this pull request as draft January 24, 2024 13:28
@aliscott aliscott force-pushed the auto-detect-support-env-name-suffix branch from df8382d to 50c3737 Compare January 24, 2024 14:09
@@ -16,19 +16,20 @@ import (
)

var (
defaultEnvVarNames = regexp.MustCompile(`^(prd|prod|production|preprod|staging|stage|stg|development|dev|release|testing|test|tst|qa|uat|live|sandbox|demo|integration|int|experimental|experiments|trial|validation|perf|sec|dr)`)
defaultEnvVarNames = regexp.MustCompile(`^(.*-)?(prd|prod|production|preprod|staging|stage|stg|development|dev|release|testing|test|tst|qa|uat|live|sandbox|demo|integration|int|experimental|experiments|trial|validation|perf|sec|dr)`)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we also add (.*-)$ at the end of this to make sure that the env is a separate token.

As well as - we might also want to support _ as a separator.

@aliscott aliscott marked this pull request as ready for review January 24, 2024 14:22
Currently we support grouping var files like `prd.tfvars` with `prd-defaults.tfvars`. This adds similar support to also group `prd.tfvars` with `defaults-prd.tfvars`.
It looks like the TFC registry has changed to point to the commit ref instead of the tag
@aliscott aliscott force-pushed the auto-detect-support-env-name-suffix branch from 20cc1be to 25d7b54 Compare January 25, 2024 09:59
@aliscott aliscott requested a review from a team as a code owner January 25, 2024 12:36
This is causing issues with the build
@aliscott aliscott force-pushed the auto-detect-support-env-name-suffix branch 2 times, most recently from 9e6ceb0 to be68a13 Compare January 25, 2024 13:29
@aliscott
Copy link
Member Author

Test failures look unrelated.

@aliscott aliscott merged commit 0afd6e9 into master Jan 25, 2024
13 of 15 checks passed
@aliscott aliscott deleted the auto-detect-support-env-name-suffix branch January 25, 2024 13:29
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

2 participants