Skip to content

Conversation

larrywax
Copy link

@larrywax larrywax commented May 23, 2025

Description

This PR fixes #952
Add sorting for vhosts after read
Add test

Relates OR Closes #952

Checklist

  • Added CHANGELOG entry (only for user-facing changes)
  • Acceptance tests where run against all supported Vault Versions

Output from acceptance testing:

$ make test TESTARGS='-v -run=TestFlattenRabbitMQSecretBackendRoleVhost_Order'                                                        (orbstack)
==> Checking that code complies with gofmt requirements...
TF_ACC= VAULT_TOKEN= go test -v -run=TestFlattenRabbitMQSecretBackendRoleVhost_Order -timeout 10m ./...
?   	github.com/hashicorp/terraform-provider-vault	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/cmd/coverage	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/cmd/generate	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/codegen	(cached) [no tests to run]
?   	github.com/hashicorp/terraform-provider-vault/helper	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/internal/consts	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/internal/identity/entity	(cached) [no tests to run]
?   	github.com/hashicorp/terraform-provider-vault/internal/identity/group	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/internal/identity/mfa	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/internal/pki	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/internal/provider	(cached) [no tests to run]
?   	github.com/hashicorp/terraform-provider-vault/internal/rotation	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/internal/sync	[no test files]
?   	github.com/hashicorp/terraform-provider-vault/schema	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/testutil	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/util	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-vault/util/mountutil	(cached) [no tests to run]
=== RUN   TestFlattenRabbitMQSecretBackendRoleVhost_Order
--- PASS: TestFlattenRabbitMQSecretBackendRoleVhost_Order (0.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-vault/vault	2.700s

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

@larrywax larrywax requested a review from a team as a code owner May 23, 2025 13:15
@larrywax larrywax requested a review from AnPucel May 23, 2025 13:15
Copy link

hashicorp-cla-app bot commented Jul 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


0 out of 2 committers have signed the CLA.

  • Giuseppe D'Anna
  • larrywax

Giuseppe D'Anna seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA.
If you have already a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@larrywax larrywax force-pushed the fix-rabbitmq-vhost-order branch from 3f2d0ce to dd9e8db Compare July 4, 2025 22:56
@larrywax
Copy link
Author

@AnPucel I've signed CLA but one of the message says the opposite. Is that a problem?

@sapleu-hc sapleu-hc requested a review from Copilot August 27, 2025 15:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a permanent diff issue in the vault_rabbitmq_secret_backend_role resource by ensuring consistent ordering of vhosts. The fix prevents unnecessary state diffs when the order of vhosts changes between Terraform operations.

  • Adds deterministic sorting to vhost processing in the flatten function
  • Includes a unit test to verify the sorting behavior works correctly

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
vault/resource_rabbitmq_secret_backend_role.go Modifies vhost flattening to sort keys before processing, ensuring consistent output order
vault/resource_rabbitmq_secret_backend_role_test.go Adds unit test to verify vhosts are returned in alphabetical order

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

change to vault_rabbitmq_secret_backend_role while not needed
1 participant