-
Notifications
You must be signed in to change notification settings - Fork 46
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-859] Update resource schema to use a single iteration block #446
[HPR-859] Update resource schema to use a single iteration block #446
Conversation
430a0e3
to
7ec2a73
Compare
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.
Saw some odd test behavior 🤔
These tests passed.
--- PASS: TestAcc_dataSourcePacker_revokedIteration (163.70s)
--- PASS: TestAcc_dataSourcePackerImage (7.83s)
--- PASS: TestAcc_dataSourcePackerImage_revokedIteration (13.53s)
--- PASS: TestAcc_dataSourcePackerImage_channelAndIterationIDReject (4.87s)
--- PASS: TestAcc_dataSourcePackerImage_channelAccept (11.32s)
--- PASS: TestAcc_dataSourcePackerIteration (6.66s)
--- PASS: TestAcc_dataSourcePackerIteration_revokedIteration (16.26s)
--- PASS: TestAccPackerChannel (10.70s)
--- PASS: TestAccPackerChannel_AssignedIteration (12.90s)
--- PASS: TestAccPackerChannel_UpdateAssignedIteration (23.41s)
--- PASS: TestAccPackerChannel_UpdateAssignedIterationWithFingerprint (6.29s)
But a few of the passing tests included errors in the logs.
TestAcc_dataSourcePackerImage_channelAndIterationIDReject
:
[WARN] sdk.helper_resource: Error running Terraform CLI command: test_name=TestAcc_dataSourcePackerImage_channelAndIterationIDReject test_step_number=1 test_terraform_path=/Users/... test_working_directory=/var/folders/...
error=
| exit status 1
|
| Error: Invalid combination of arguments
|
| with data.hcp_packer_image.arch-btw,
| on terraform_plugin_test.tf line 6, in data "hcp_packer_image" "arch-btw":
| 6: iteration_id = "234567"
|
| "iteration_id": only one of `channel,iteration_id` can be specified, but
| `channel,iteration_id` were specified.
TestAcc_dataSourcePackerImage
:
error=
| exit status 1
|
| Error: Unable to load image (region: us-east-1, cloud: aws, iteration: 01GR70830X8A1ZKYJYDGFPPNYH, component_type: amazon-ebs.do-not-exist).
|
| with data.hcp_packer_image.foo,
| on terraform_plugin_test.tf line 7, in data "hcp_packer_image" "foo":
| 7: data "hcp_packer_image" "foo" {
|
test_name=TestAcc_dataSourcePackerImage
And TestAcc_dataSourcePacker
was the only test that actually failed. I think this might be running into a bug in provider_test, so I can take a look at that and report back.
provider_test.go:94: [{1 You may experience issues using HCP. HCP is reporting the following:
HCP API: operational
HCP Consul: degraded_performance
HCP Packer: operational
HCP Vault: operational
HCP Portal: operational
Please check https://status.hashicorp.com for more details. []}]
--- FAIL: TestAcc_dataSourcePacker (1.36s)
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ExactlyOneOf: []string{"iteration.0.id", "iteration.0.fingerprint", "iteration.0.incremental_version"}, |
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.
To clarify what's being enforced here, there can only be one of id
or fingerprint
or incremental_version
set at a time?
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.
Yea, that’s correct. A practitioner should only be allowed to use one of the attributes for iteration assignment.
Allowing the ability to set multiple seems confusing and exposes a limitation in the upstream API where if multiple params are in the request the id take precedence. Which is the reason why I use HasChanges to only select the input that has changed before posting to the API.
Is this error generated by the |
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.
Looks like my test failures were related to an underlying provider bug, which I've just fixed: #448
This looks good to me! Glad you dug into this and found the best TF guardrails for this attribute. 🌞
Thank you @bcmdarroch I appreciate you sticking with me on the two implementations and for your insight. I'm going to merge this change into the other branch, and then rebase/squash #435 to get this change in. |
f066cc1
to
76b872b
Compare
The current implementation relies on the use of an extra iteration_assignment block to denote what iteration to assign to a channel. Instead of defining a separate block this change uses the single iteration block to denote the state of a channel. Modifying the iteration block will trigger the respective updates to the state of a channel. Removing the iteration block will remove the assigned iteration from the channel.
7ec2a73
to
b6b9aa7
Compare
🛠️ Description
The current implementation relies on the use of an extra iteration_assignment block to denote what iteration to assign to a channel. Instead of defining a separate block this change uses the single iteration block to denote the state of a channel. Modifying the iteration block will trigger the respective updates to the state of a channel. Removing the iteration block will remove the assigned iteration from the channel.
Potentially Supersedes #435
🏗️ Acceptance tests
Output from acceptance testing: