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

Add the ability to pulumi.unsecret an existing output #6086

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Jan 11, 2021

Related: #5653

This will take an existing output and then unwrap the secret, and
return a new output

import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
export const xVal = x;

const y = pulumi.unsecret(x);
export const yVal = y;
▶ pulumi stack output
Current stack outputs (3):
    OUTPUT         VALUE
    xVal           [secret]
    yVal           test

Also adds the ability to check if an output is as secret:

import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
const isSecret = pulumi.isSecret(x);

export const isSecretDeets = isSecret;

@stack72 stack72 requested review from justinvp and komalali and removed request for justinvp January 11, 2021 19:19
@stack72 stack72 self-assigned this Jan 11, 2021
@stack72 stack72 changed the title Add the ability to pulumi.Unsecret an existing output Add the ability to pulumi.unsecret an existing output Jan 11, 2021
@stack72
Copy link
Contributor Author

stack72 commented Jan 11, 2021

After speaking with @lukehoban we are going to revert the changes to IsSecret and have a top level func 'isSecret' alongside 'unsecret' - this will ensure we don't break the backwards compatibility with old versions

Copy link
Member

@komalali komalali left a comment

Choose a reason for hiding this comment

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

Couple of comment/changelog things to fix up but otherwise LGTM

CHANGELOG.md Outdated Show resolved Hide resolved
sdk/nodejs/output.ts Outdated Show resolved Hide resolved
sdk/nodejs/output.ts Outdated Show resolved Hide resolved
sdk/nodejs/output.ts Show resolved Hide resolved
sdk/nodejs/output.ts Show resolved Hide resolved
sdk/nodejs/output.ts Show resolved Hide resolved
sdk/nodejs/output.ts Outdated Show resolved Hide resolved
Related: #5653

This will take an existing output and then unwrap the secret, and
return a new output

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
export const xVal = x;

const y = pulumi.unsecret(x);
export const yVal = y;
```

```
▶ pulumi stack output
Current stack outputs (3):
    OUTPUT         VALUE
    xVal           [secret]
    yVal           test
```

Also adds the ability to check if an output is as secret:

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
const isSecret = x.isSecret;

export const isSecretDeets = isSecret;
```
@stack72
Copy link
Contributor Author

stack72 commented Jan 14, 2021

So @justinvp and I had a call about this - we are going to leave these funcs as taking the Output itself for now - if we decide that needs to change in the future then we can do so.

@stack72 stack72 merged commit ae9a6db into master Jan 14, 2021
@pulumi-bot pulumi-bot deleted the unsecret-nodejs branch January 14, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants