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

4.9.0 regenerates passwords #258

Closed
mortaelth opened this issue Jan 27, 2023 · 2 comments
Closed

4.9.0 regenerates passwords #258

mortaelth opened this issue Jan 27, 2023 · 2 comments
Assignees
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@mortaelth
Copy link

What happened?

We have following code

const token = new random.RandomPassword(
    core.prefix("access-token"),
    {
        length: 16,
        overrideSpecial: "_%@:",
        special: true,
    },
    {
        parent: rootResource,
        additionalSecretOutputs: ["result"],
        aliases: [{ parent: sharedKeyVault.urn }],
    }
);

after upgrade from 4.8.2 to 4.9.0, the output was regenerated

Expected Behavior

Upgrade of the library will not regenerate the output.

Steps to reproduce

as above

Output of pulumi about

CLI
Version 3.51.1
Go Version go1.19.4
Go Compiler gc

Plugins
NAME VERSION
azure 5.32.0
azure-native 1.93.0
azuread 4.3.0
grafana 0.0.5
kubernetes 3.23.1
nodejs unknown
random 4.9.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@mortaelth mortaelth added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jan 27, 2023
@t0yv0 t0yv0 self-assigned this Jan 27, 2023
@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jan 27, 2023
@t0yv0
Copy link
Member

t0yv0 commented Jan 27, 2023

Thank you for this issue, this appears to be indeed a miss on our end.

I was able to repro an the issue is that Pulumi generates a Replace plan because of this diff:

DIFF: AttributeName("numeric"): value1: tftypes.Bool<null>, value2: tftypes.Bool<"true">

The upstream provider now implements state migrations that would have corrected "numeric" attribute to its default value:
https://github.com/https://github.com/terraform-providers/terraform-provider-random/blob/85a935b41296ee993960046f7ff3b1043d3051e3/internal/provider/resource_password.go#L164-#L164

But the state upgrade feature is not yet implemented in the bridge:
pulumi/pulumi-terraform-bridge#748

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

const token = new random.RandomPassword(
    "access-token-",
    {
        length: 16,
        overrideSpecial: "_%@:",
        special: true,
    },
    {
        // parent: rootResource,
        additionalSecretOutputs: ["result"],
        // aliases: [{ parent: sharedKeyVault.urn }],
    }
);

export const x = token.result;
#!/usr/bin/env bash

set -euo pipefail

pulumi destroy --yes

npm i @pulumi/random@4.8.0
jq '.packages["node_modules/@pulumi/random"].version' package-lock.json
pulumi up --yes --skip-preview
pulumi stack output --show-secrets

npm i @pulumi/random@4.9.0
jq '.packages["node_modules/@pulumi/random"].version' package-lock.json
PULUMI_DEBUG_GRPC=$PWD/replace.json pulumi up --yes --skip-preview
pulumi stack output --show-secrets

I'm looking into getting state upgrades supported and then will circle back to release a new version of pulumi-random that fixes the problem.

@t0yv0 t0yv0 pinned this issue Jan 27, 2023
@t0yv0 t0yv0 added the p1 A bug severe enough to be the next item assigned to an engineer label Jan 27, 2023
t0yv0 added a commit to pulumi/pulumi-terraform-bridge that referenced this issue Jan 27, 2023
@t0yv0
Copy link
Member

t0yv0 commented Jan 27, 2023

We've pulled the release and reverted the changes in 4.10.0. Apologies for the disruption!

@t0yv0 t0yv0 added the resolution/fixed This issue was fixed label Jan 27, 2023
@t0yv0 t0yv0 closed this as completed Jan 27, 2023
@t0yv0 t0yv0 unpinned this issue Jan 27, 2023
@mikhailshilkov mikhailshilkov added the impact/regression Something that used to work, but is now broken label Jan 30, 2023
t0yv0 added a commit to pulumi/pulumi-terraform-bridge that referenced this issue Feb 7, 2023
t0yv0 added a commit to pulumi/pulumi-terraform-bridge that referenced this issue Feb 7, 2023
Implement State Upgrade in the Terraform Plugin Framework.

State Upgrade allows migrations written against Plugin Framework to run as part of the pulumi deployment using a bridged provider.  The bridged provider now continues to tracks in the version of resource state in the special `__meta` property.

This change provides important continuity for providers that upgrade from pre-Plugin Framework version to the new Plugin Framework bridge. For example, it resolves pulumi/pulumi-random#258 issue where such an upgrade introduced unexpected replacements for Random Password resources. 

---------

Co-authored-by: Jasmine Dahilig <jasmine.dahilig@gmail.com>
@t0yv0 t0yv0 added this to the 0.84 milestone Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants