-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: GitHub tests emitting unexpected keepers = {} #4462
Conversation
Version v3.6.1 of the 'random' provider changed the behavior of 'keeper' in hashicorp/terraform-provider-random#385 This upstream change caused the extra keepers = {} output in our test output since keepers are optional, and {} is same as absent for our use-cases, we're removing the empty keepers = {} from the .tf files
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.
LGTM thanks @jippi
@@ -1,4 +1,3 @@ | |||
resource "random_id" "dummy1" { |
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.
Since this issue came from a provider version update, to keep the tests deterministic, what do you think of pinning the provider versions for each of these terraform random provider (and possibly other provider) tests?
We can add it to main.tf
or add a new versions.tf
like upstream modules do it.
resource "random_id" "dummy1" { | |
provider "random" {} | |
terraform { | |
required_providers { | |
random = { | |
source = "hashicorp/random" | |
version = "= 3.6.1" | |
} | |
} | |
} | |
resource "random_id" "dummy1" { |
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.
I agree we should probably pin this, or at least worth a discussion. I'm fine making that a followup and merging this as-is, since unit tests being broken on main is causing downstream issues.
@@ -1,4 +1,3 @@ | |||
resource "random_id" "dummy2" { |
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.
Related https://github.com/runatlantis/atlantis/pull/4462/files#r1573148934
resource "random_id" "dummy2" { | |
terraform { | |
required_providers { | |
random = { | |
source = "hashicorp/random" | |
version = "= 3.6.1" | |
} | |
} | |
} | |
resource "random_id" "dummy2" { |
declare -r output | ||
|
||
if [[ -n "$output" ]]; then | ||
echo "These files had their 'import' changed - please fix them locally and push a fix" |
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.
In the future, we may be able to automate this via pre-commit-config
thanks @jippi for the contribution |
/cherry-pick release-0.27 |
Co-authored-by: Christian Winther <[email protected]>
what
Version v3.6.1 of the
random
provider changed the behavior ofkeepers
in hashicorp/terraform-provider-random#385This upstream change caused the extra
keepers = {}
output in our test output due to how thevalue
ofkeepers
inside the provider is processed.Since
keepers
are optional in the provider and{}
is same asabsent
(ornull
) for our use-cases, I'm removing the emptykeepers = {}
from the.tf
filesI also fixed
make check-fmt
since it was failing silently withgoimports
not being installed in CI.why
I like tests passing
tests
All changes are test related - and pure output focused - shouldn't affect any actual behavior
references