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: GitHub tests emitting unexpected keepers = {} #4462

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

jippi
Copy link
Contributor

@jippi jippi commented Apr 19, 2024

what

Version v3.6.1 of the random provider changed the behavior of keepers in hashicorp/terraform-provider-random#385

This upstream change caused the extra keepers = {} output in our test output due to how the value of keepers inside the provider is processed.

Since keepers are optional in the provider and {} is same as absent (or null) for our use-cases, I'm removing the empty keepers = {} from the .tf files

I also fixed make check-fmt since it was failing silently with goimports 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

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
@jippi jippi requested review from a team as code owners April 19, 2024 20:22
@jippi jippi requested review from GenPage, lukemassa and X-Guardian and removed request for a team April 19, 2024 20:22
Copy link
Contributor

@jamengual jamengual left a comment

Choose a reason for hiding this comment

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

LGTM thanks @jippi

jamengual
jamengual previously approved these changes Apr 19, 2024
@@ -1,4 +1,3 @@
resource "random_id" "dummy1" {
Copy link
Member

@nitrocode nitrocode Apr 20, 2024

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.

Suggested change
resource "random_id" "dummy1" {
provider "random" {}
terraform {
required_providers {
random = {
source = "hashicorp/random"
version = "= 3.6.1"
}
}
}
resource "random_id" "dummy1" {

Copy link
Contributor

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" {
Copy link
Member

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

Suggested change
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"
Copy link
Member

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

@jamengual jamengual merged commit 287add4 into runatlantis:main Apr 24, 2024
23 checks passed
@jamengual
Copy link
Contributor

thanks @jippi for the contribution

@lukemassa
Copy link
Contributor

/cherry-pick release-0.27

lukemassa pushed a commit to lukemassa/atlantis that referenced this pull request Apr 24, 2024
lukemassa added a commit that referenced this pull request Apr 24, 2024
Co-authored-by: Christian Winther <jippignu@gmail.com>
@lukemassa lukemassa mentioned this pull request Apr 25, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants