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

New resources vault_plugin and vault_plugin_pinned_version #2159

Merged
merged 26 commits into from
May 7, 2024

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Feb 26, 2024

Description

Adds 2 new resources for managing external plugins; vault_plugin and vault_plugin_pinned_version.

Relates #1975
Closes #214

Checklist

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

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestPlugin'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -run=TestPlugin -timeout 30m ./...
?       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]
?       github.com/hashicorp/terraform-provider-vault/helper    [no test files]
?       github.com/hashicorp/terraform-provider-vault/internal/consts   [no test files]
?       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]
ok      github.com/hashicorp/terraform-provider-vault/codegen   (cached) [no tests to run]
ok      github.com/hashicorp/terraform-provider-vault/internal/identity/entity  (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/internal/sync     [no test files]
?       github.com/hashicorp/terraform-provider-vault/schema    [no test files]
?       github.com/hashicorp/terraform-provider-vault/util/mountutil    [no test files]
ok      github.com/hashicorp/terraform-provider-vault/internal/provider (cached) [no tests to run]
ok      github.com/hashicorp/terraform-provider-vault/testutil  (cached) [no tests to run]
ok      github.com/hashicorp/terraform-provider-vault/util      (cached) [no tests to run]
ok      github.com/hashicorp/terraform-provider-vault/vault     2.780s

Example config:

provider "vault" {
}

resource "vault_plugin" "jwt" {
  type    = "auth"
  name    = "jwt"
  command = "vault-plugin-auth-jwt"
  version = "v0.17.0"
  sha256  = "6bd0a803ed742aa3ce35e4fa23d2c8d550e6c1567bf63410cec489c28b68b0fc"
  env     = [
    "HTTP_PROXY=http://proxy.example.com:8080"
  ]
}

resource "vault_plugin_pinned_version" "jwt_pin" {
  type    = vault_plugin.jwt.type
  name    = vault_plugin.jwt.name
  version = vault_plugin.jwt.version
}

resource "vault_auth_backend" "jwt_auth" {
  type = vault_plugin_pinned_version.jwt_pin.name
}

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

@tomhjp tomhjp changed the title New resources vault_plugin and vault_plugin_pinned_version New resources vault_plugin and vault_plugin_pinned_version Feb 26, 2024
@tomhjp tomhjp marked this pull request as ready for review March 1, 2024 16:01
@tomhjp
Copy link
Contributor Author

tomhjp commented Mar 1, 2024

Sorry - the tests are taking a bit longer than I expected. I'm working on them in https://github.com/hashicorp/terraform-provider-vault/compare/vault-24407/plugin-and-pinned-versions-support-testing?expand=1 but feel free to ignore this PR until I get them working.

@tomhjp
Copy link
Contributor Author

tomhjp commented Mar 1, 2024

The tests should pass now 👍 and I've verified that TestPlugin is running and not being skipped, but TestPluginPinnedVersion won't run in CI until we have 1.16 in the acceptance tests matrix.

@fairclothjm fairclothjm added this to the 4.0.0 milestone Mar 6, 2024
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.

Overall LGTM. My only question is should we be checking for the resource existence and unsetting the id to remove it from TF state for both vault_plugin_pinned_version and vault_plugin?

Copy link
Contributor

@vinay-gopalan vinay-gopalan left a comment

Choose a reason for hiding this comment

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

Looking great so far! Had a couple of questions/suggestions :)

vault/resource_plugin.go Show resolved Hide resolved
vault/resource_plugin.go Outdated Show resolved Hide resolved
vault/resource_plugin.go Outdated Show resolved Hide resolved
vault/resource_plugin_pinned_version.go Outdated Show resolved Hide resolved
vault/resource_plugin_pinned_version.go Outdated Show resolved Hide resolved
@fairclothjm fairclothjm removed this from the 4.0.0 milestone Mar 13, 2024
@fairclothjm fairclothjm added this to the 4.3.0 milestone May 1, 2024
website/vault.erb Outdated Show resolved Hide resolved
website/vault.erb Outdated Show resolved Hide resolved
Copy link
Contributor

@vinay-gopalan vinay-gopalan left a comment

Choose a reason for hiding this comment

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

Thanks for working on this and responding to feedback! LGTM, had a few nits and suggestions fixes for docs sidebars, but should be good to go otherwise 😄

tomhjp and others added 4 commits May 7, 2024 15:26
Co-authored-by: vinay-gopalan <86625824+vinay-gopalan@users.noreply.github.com>
Co-authored-by: vinay-gopalan <86625824+vinay-gopalan@users.noreply.github.com>
Co-authored-by: vinay-gopalan <86625824+vinay-gopalan@users.noreply.github.com>
@tomhjp
Copy link
Contributor Author

tomhjp commented May 7, 2024

Thanks!

@tomhjp tomhjp merged commit 89132d1 into main May 7, 2024
13 checks passed
@tomhjp tomhjp deleted the vault-24407/plugin-and-pinned-versions-support branch May 7, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support configuring plugins in Vault's plugin catalog
3 participants