Ivan Petrov
Ivan Petrov

Reputation: 145

How can I fix provider.vault: no vault token found?

Here're the official docs about vault provider and the thing is:

provider "vault" {
  version = "2.10.0"
  address = "..."
}

I did set both VAULT_ADDR and VAULT_TOKEN:

terraform plan -lock=false dev/foo_dev
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.aws_iam_policy_document.foo_doc: Refreshing state...

------------------------------------------------------------------------

Error: Error running plan: 1 error occurred:
        * provider.vault: no vault token found
make: *** [plan] Error 1
✗ echo $VAULT_ADDR 
...
✗ echo $VAULT_TOKEN
...

token - (Required) Vault token that will be used by Terraform to authenticate. May be set via the VAULT_TOKEN environment variable.

If I remove address = "..." I can see the same error so it can't retrieve VAULT_ADDR either.

Upvotes: 2

Views: 6854

Answers (2)

Vivek
Vivek

Reputation: 1

$Env:VAULT_TOKEN="Your Token data (Click your profile on top right and copy token)"
$Env:VAULT_ADDR="https://Vault.company.com(Vault URL)"

Enter this info on your powershell command prompt/VSD prior to doing terraform plan.

Upvotes: 0

lxop
lxop

Reputation: 8595

Did you export the variables? You need to use

export VAULT_TOKEN=s.123456789abc
export VAULT_ADDR=vault.company.org

not just

VAULT_TOKEN=s.123456789abc
VAULT_ADDR=vault.company.org

otherwise terraform won't see those variables.

Upvotes: 3

Related Questions