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

Add missing parameters to vault_mount #2235

Merged
merged 3 commits into from
May 28, 2024

Conversation

vinay-gopalan
Copy link
Contributor

Description

Adds parameters to the resource that were missing, including newly 1.16 added fields.

Checklist

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

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@vinay-gopalan vinay-gopalan requested review from a team and sgmiller May 8, 2024 01:10
Copy link
Contributor

@fairclothjm fairclothjm left a comment

Choose a reason for hiding this comment

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

LGTM

@benashz benashz self-requested a review May 8, 2024 10:43
Copy link
Contributor

@benashz benashz left a comment

Choose a reason for hiding this comment

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

I had one question about this change, other than that it looks pretty straightforward.

It does look like the tests are not passing e.g: https://github.com/hashicorp/terraform-provider-vault/actions/runs/8994620751/job/24708374987?pr=2235#step:9:1766

Will you also be doing the docs update under this PR?

@@ -236,8 +305,32 @@ func updateMount(d *schema.ResourceData, meta interface{}, excludeType bool) err
path = newPath
}

if d.HasChange("allowed_managed_keys") {
config.AllowedManagedKeys = expandStringSlice(d.Get("allowed_managed_keys").(*schema.Set).List())
if d.HasChange(consts.FieldAllowedManagedKeys) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, is there a reason we are conditionally setting these new parameters, rather than always setting them?

Copy link
Contributor Author

@vinay-gopalan vinay-gopalan May 8, 2024

Choose a reason for hiding this comment

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

It's mostly because they all have varied minimum version requirements. We can't always set them since some fields are only enabled on certain Vault versions.

The idea is that all these params will only be added in if the user provides them / makes a change to them. The expectation is that if a user is providing us a field to use, then they are aware of their Vault Server and its API features/limitations. We can also individually add version checks for all the older versions to the parameters, I chose this route for simplicity and to avoid annoying conditionals like "If this greater than this version but less than that version do this" etc.

@vinay-gopalan
Copy link
Contributor Author

I had one question about this change, other than that it looks pretty straightforward.

It does look like the tests are not passing e.g: https://github.com/hashicorp/terraform-provider-vault/actions/runs/8994620751/job/24708374987?pr=2235#step:9:1766

Will you also be doing the docs update under this PR?

Good catch! Docs slipped my mind and I will add them in. And yes! The tests failures are expected, looks like the TFVP helped uncover a bug in a newly added Vault 1.16.x field. There is a fix PR up on the Vault repo. For now, I'll add a TODO note to fix that test, and we can update that test once the fix is merged into Vault. Thanks for the thoroughness!

Copy link
Contributor

@fairclothjm fairclothjm 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 for doing this!

@vinay-gopalan vinay-gopalan merged commit 4ef2eea into main May 28, 2024
1 of 2 checks passed
@vinay-gopalan vinay-gopalan deleted the VAULT-26402/add-missing-mount-headers branch May 28, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants