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

Do not fail packer datasources for iteration with revoke_at set to the future #262

Merged
merged 2 commits into from
Mar 2, 2022

Conversation

sylviamoss
Copy link
Contributor

@sylviamoss sylviamoss commented Mar 2, 2022

🛠️ Description

The hcp_packer_x datasources were checking if an iteration had a revoke_at to tell if it's revoked or not. This was wrong because a revoke_at set to the future means that revocation is scheduled and the iteration is currently valid.
This PR fixes this behaviour and only fails for revoked_at <= now

🚢 Release Note

Release note for CHANGELOG:

* datasource/hcp_packer_image: Fix check for revoked iterations to consider scheduled revocation valid [GH-262]
* datasource/hcp_packer_iteration: Add check for revoked iterations to consider scheduled revocation valid [GH-262]
* datasource/hcp_packer_image_iteration: Add check for revoked iterations to consider scheduled revocation valid [GH-262]

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

TF_ACC=1 go test ./internal/... -v -run=TestAcc_dataSourcePacker -timeout 120m
?       github.com/hashicorp/terraform-provider-hcp/internal/clients    [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/consul     (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/input      (cached) [no tests to run]
=== RUN   TestAcc_dataSourcePacker
--- PASS: TestAcc_dataSourcePacker (29.76s)
=== RUN   TestAcc_dataSourcePacker_revokedIteration
--- PASS: TestAcc_dataSourcePacker_revokedIteration (13.60s)
=== RUN   TestAcc_dataSourcePacker_iterationScheduledToBeRevoked
--- PASS: TestAcc_dataSourcePacker_iterationScheduledToBeRevoked (26.23s)
=== RUN   TestAcc_dataSourcePackerImage
--- PASS: TestAcc_dataSourcePackerImage (27.55s)
=== RUN   TestAcc_dataSourcePackerIteration
--- PASS: TestAcc_dataSourcePackerIteration (27.64s)
=== RUN   TestAcc_dataSourcePackerIteration_revokedIteration
--- PASS: TestAcc_dataSourcePackerIteration_revokedIteration (13.19s)
=== RUN   TestAcc_dataSourcePackerIteration_iterationScheduledToBeRevoked
--- PASS: TestAcc_dataSourcePackerIteration_iterationScheduledToBeRevoked (26.87s)
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider   165.150s

@sylviamoss sylviamoss requested a review from a team March 2, 2022 13:51
Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

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

Nice one! LGTM!

Copy link
Contributor

@bcmdarroch bcmdarroch left a comment

Choose a reason for hiding this comment

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

Nice work!

@bcmdarroch bcmdarroch merged commit 4de19cd into main Mar 2, 2022
@bcmdarroch bcmdarroch deleted the hcp_packer_fix_revoked_iteration_check branch March 2, 2022 18:35
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.

3 participants