Terraform-provider-vault: Feature Request: Add support for KV v2

Created on 15 Jun 2018  路  12Comments  路  Source: hashicorp/terraform-provider-vault

Terraform Version

Terraform v0.11.7
+ provider.aws v1.23.0
+ provider.vault v1.1.0

Details

Per Issue #66 it seems the terraform-provider-vault does not support the new v2 KV store. Bummer!

Feature request to add support for KV v2.

See #66 for details on what happens when you use a KV v2 secret store.

TLDR:

When using a KV v2 path and this provider, you get an error:

* data.vault_generic_secret.this: data.vault_generic_secret.this: No secret found at "kv-v2/example"
0.11.1

Most helpful comment

Pls

All 12 comments

this is holding us up from being able to upgrade to KV v2 in vault 0.10.1 as well; would love to have this feature in the vault terraform provider.

Pls

pretty... plz

If we can't have full support immediately, how about at least support for reading/writing?

cat vault_test.tf 
provider "vault" {
}

resource "vault_generic_secret" "secret1" {
  path = "secret/data/secret1" 
    data_json = <<EOF
      {
        "key1": "val1",
        "keytwo": "valtwo"
      }
EOF
}
terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + vault_generic_secret.secret1
      id:           <computed>
      data_json:    "{\"key1\":\"val1\",\"keytwo\":\"valtwo\"}"
      disable_read: "false"
      path:         "secret/data/secret1"


Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

vault_generic_secret.secret1: Creating...
  data_json:    "" => "{\"key1\":\"val1\",\"keytwo\":\"valtwo\"}"
  disable_read: "" => "false"
  path:         "" => "secret/data/secret1"

Error: Error applying plan:

1 error(s) occurred:

* vault_generic_secret.secret1: 1 error(s) occurred:

* vault_generic_secret.secret1: error writing to Vault: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/secret/data/secret1
Code: 400. Errors:

* no data provided

I'm currently working on updating everything to work with Vault 0.11.1, including fixing acceptance tests, which includes updating for this to be compatible for KV V2. I'll link the PR when it lands.

Thanks, Becca!

Here's the first PR in the series: https://github.com/terraform-providers/terraform-provider-vault/pull/170. I see a couple of other failing acceptance tests that may be related to the functionality, so I'm not ready to bless it yet, but I'll keep hacking away at them and linking them here.

@tyrannosaurus-becks Any update on this? We currently have a couple of broken Terraform modules because of this incompatibility.

This should be solved and released via https://github.com/terraform-providers/terraform-provider-vault/pull/156. Can you confirm it looks good to you?

@tyrannosaurus-becks Looks like it went in but was somehow missed on the v1.2.0 release...

What was actually released: https://github.com/terraform-providers/terraform-provider-vault/commits/e40d203182977b88e8b9656bd0800abe4bd982b9

Master: https://github.com/terraform-providers/terraform-provider-vault/commits/master

Ah thanks for pointing that out! I just released v1.3.0 and it should be good to go.

@tyrannosaurus-becks Brilliant this works perfectly now, thank-you!! 馃槃

Was this page helpful?
0 / 5 - 0 ratings