hashicorp / terraform-provider-vault

Terraform Vault provider
https://www.terraform.io/docs/providers/vault/
Mozilla Public License 2.0
457 stars 536 forks source link

vault_token_auth_backend_role fails to set correct period on first Terraform run #257

Open lukassup opened 5 years ago

lukassup commented 5 years ago

Terraform Version

terraform -v
Terraform v0.11.10

Affected Resource(s)

Terraform Configuration Files

resource "vault_policy" "example_policy" {
  name = "example-policy"
  policy = <<EOT
# read secret (v2)
path "secret/pr/data/example/*" {
  capabilities = ["read"]
}
# list secrets and read secret metadata (v2)
path "secret/pr/metadata/example/*" {
  capabilities = ["list", "read"]
}
EOT
}

resource "vault_token_auth_backend_role" "example_role" {
  role_name = "example-role"
  allowed_policies = [
    "default",
    "example-policy",
  ]
  orphan    = true
  period    = "2764800"
  renewable = true
}

Expected Behavior

Running terraform apply a second time should not do any changes. The run should be idempotent.

Actual Behavior

Running terraform apply a second time reports that period has to be changed:

vault_token_auth_backend_role.example_role: Modifying... (ID: auth/token/roles/example-role)
period: "0" => "2764800"

Steps to Reproduce

  1. terraform apply
  2. terraform apply

References

cvbarros commented 5 years ago

Passing #255 review, this is one of the cases where TTL treatment standardization would be an easy fix.