-
Notifications
You must be signed in to change notification settings - Fork 5
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
Vault provider does not tolerate token provided #118
Comments
@dimitryvoronov Are you able to provide a repro case? We would expect the values in the program to be used. Have you confirmed that that block where you're providing values gets used and that the provider instance that consumes those values is provided to the resource in question? |
Hello @leezen
So, provider as I understand should use the values provided to it, but it's not, and even the token we provide via value does not appear in stack config. Do you know if it should be written in stack config once you defined it in code? |
@leezen This is not trivial to create a repro case for as it requires having a token in the statefile become stale, but I did just run into this. The workarounds that I found to work are:
These are both still unideal, but provided me with enough of a workaround for now |
Might this have to do with passing |
@leezen @dmattia I think I can provide a repro case:
As @dimitryvoronov mentioned it happens due to expired token stored into statefile and only one solution I found is to update vault provider before any of those actions. Something like:
But it looks like a hack (and actualy it is) and I'd prefer to find better approach. |
I think I am having the same issue, using typescript.
when running Error:
|
UPDATE: it didn't work, again deletion failed! destroying everything in the stack first then using following provider options solved it for me for now, using userpass auth
|
This is indeed an issue. In our case, we fetch login details, do an explicit login and pass that to the provider. It works the first time, until that token expires - at that point in time, the stack value is the only thing Pulumi cares about. const approle = await vault.generic.getSecret({
path: "kv/pulumi"
});
const login = new vault.approle.AuthBackendLogin("login", {
backend: "approle",
roleId: approle.data.roleId,
secretId: approle.data.secretId,
});
this._provider = new vault.Provider("namespace-provider", {
address: this.vaultProviderConfig.require("address"),
token: login.clientToken,
namespace: `${this.config.require("root")}/${this.name}`,
}); Not so sure there's an easy fix though. Here's how I solved it for using an approle: this._provider = new vault.Provider("namespace-provider", {
address: this.vaultProviderConfig.require("address"),
token: "-", // Required parameter, but not used.
authLogin: {
path: `auth/approle/login`,
namespace: this.config.require("root"),
parameters: {
role_id: approle.data.roleId,
secret_id: approle.data.secretId
}
},
namespace: `${this.config.require("root")}/${this.name}`,
}); |
Also run into this issue today.
It will be something like
Delete
|
This issue is still happening, and other than the fact that this makes using the pulumi-vault provider very difficult, it's also the only plain-text secret saved in the pulumi checkpoint file. I think if the bug is not gonna be fixed, at minima a big red warning should be added to the provider documentation page to let people know that this provider saves credentials in clear-text in the checkpoint file as this is not how pulumi usually works. |
This issue is still happening. |
Steps to reproduce
Please notice that we optionally define vault token and addr.
2. Run pulumi up or pulumi update to get info about vault objects in stack config
3. Examine stack export for vault token
Expected:
We expect that vault token provider either reads definition on provider level of Address and Token OR
VAULT_ADDR and VAULT_TOKEN environment variables.
Actual:
After the first run token which stored in pulumi stack is not updated anymore.It was working fine for a default period of time o the token which is 32 days, then all our jobs started to fail with
URL: GET https://magic-vault.example.com:8082/v1/auth/token/lookup-self
Code: 403. Errors:
After investigation we found that old, expired token is stored on pulumi stack config and provider always reads it.
We checked this behavior on couple versions, the latest and 2.4.1(used originally)
Then we explicitly defined Address and Token on provider level and set both via config settings and that did not help.
Each time we run pulumi up or pulumi update vault provider still reads token ONLY from pulumi stack (stored on S3 bucket)
The text was updated successfully, but these errors were encountered: