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

HPR-1177: Assigned iteration should not be forced to be null when no iteration block is present #521

Merged
merged 6 commits into from
Jun 6, 2023

Conversation

aidan-mundy
Copy link
Contributor

@aidan-mundy aidan-mundy commented Jun 3, 2023

🛠️ Description

Previously, when no iteration block existed on hcp_packer_channel, the provider would treat external management of the channel's iteration assignment as configuration drift and the assignment would be removed on next apply. Now, the channel's assigned iteration is ignored when there is no iteration block present. In use cases where users may want to force a channel to have no assigned iteration, they can use a zero value for one of the attributes in the iteration block.

Additionally, these changes enhance plans by populating the 2 unset iteration block attributes with the data associated with the 1 set attribute. This improves visibility in cases where the iteration associated with the chosen attribute may change due to external modifications (ex: deletion of an iteration with fingerprint xyz and then uploading another iteration with the fingerprint manually set to xyz, or deleting the latest complete iteration assigned version 7 and then uploading a new complete iteration which will then be automatically assigned version 7). In cases where the 1 set attribute is not associated with any iteration, these changes move failure up the chain from apply-time to plan-time.

🏗️ 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:

$ make testacc TESTARGS='-run=TestAcc.*PackerChannel.*'
==> Checking that code complies with gofmt requirements...
golangci-lint run --config ./golangci-config.yml 
TF_ACC=1 go test ./internal/... -v -run=TestAcc.*PackerChannel.* -timeout 360m -parallel=10
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/clients    (cached) [no tests to run]
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   TestAccPackerChannel
--- PASS: TestAccPackerChannel (8.93s)
=== RUN   TestAccPackerChannel_AssignedIteration
--- PASS: TestAccPackerChannel_AssignedIteration (9.06s)
=== RUN   TestAccPackerChannel_UpdateAssignedIteration
--- PASS: TestAccPackerChannel_UpdateAssignedIteration (14.08s)
=== RUN   TestAccPackerChannel_UpdateAssignedIterationWithFingerprint
--- PASS: TestAccPackerChannel_UpdateAssignedIterationWithFingerprint (6.44s)
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider   38.876s

@aidan-mundy aidan-mundy added the bug Something isn't working label Jun 3, 2023
@aidan-mundy aidan-mundy changed the title HPR-1177: Assigned iteration should not be forced to be null when no iteration HPR-1177: Assigned iteration should not be forced to be null when no iteration block is present Jun 3, 2023
@aidan-mundy aidan-mundy marked this pull request as ready for review June 3, 2023 04:00
@aidan-mundy aidan-mundy requested a review from a team as a code owner June 3, 2023 04:00
@aidan-mundy aidan-mundy force-pushed the HPR-1177/stop-clearing-channel-assignments branch from 7bf0604 to 71b10fe Compare June 3, 2023 04:12
@aidan-mundy aidan-mundy force-pushed the HPR-1177/stop-clearing-channel-assignments branch from f032ac5 to 630caaf Compare June 5, 2023 16:46
Copy link
Contributor

@sylviamoss sylviamoss left a comment

Choose a reason for hiding this comment

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

Looks good! Made a suggestion with wording and that's all. I tested it myself and it is all good 👍🏼

docs/resources/packer_channel.md Show resolved Hide resolved
templates/resources/packer_channel.md.tmpl Outdated Show resolved Hide resolved
docs/resources/packer_channel.md Outdated Show resolved Hide resolved
@aidan-mundy aidan-mundy merged commit f42ada2 into main Jun 6, 2023
@aidan-mundy aidan-mundy deleted the HPR-1177/stop-clearing-channel-assignments branch June 6, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants