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

The Environment Variable Keep Replacing #4820

Open
KienKeng107 opened this issue Nov 22, 2024 · 2 comments
Open

The Environment Variable Keep Replacing #4820

KienKeng107 opened this issue Nov 22, 2024 · 2 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec service/cloudfront

Comments

@KienKeng107
Copy link

What happened?

I just created the AWS CloudFront public key and added it to the environment as a secret variable by running this command:

cat ./public_key.pem | pulumi config set public_key --secret

I was able to deploy the public key to CloudFront successfully. However, every time I run pulumi preview or pulumi up, the public key is being replaced.
Image

Example

pulumi.develop.yaml file

config:
  ...
  ...
  public-key:
    secure: AAABAJOP0wyBsseRieHS9v69QAG5d3FgKlesm98Q6SAjSavuP/dzEH6EMIrouDnS/yxJz+dzLH4FcqMy7sb2ymekYYX/6p3J21/4yrOHCdBraJcfM4GKwc1ITElpauvMfKvI51r+NAlax3E4M8Qp8qnVCCLcgmfdWjyMXWAo+T2J+zmZ8htKvLoyHfOKY6/ahKIke/Kvlu9F60yFcNFvc1aWWX/s+7UAq2CH1dVYnmeDKmwRwVUTqHL+v420gT5Nz6iT55LrlhfM7pQOgcyR0ctq9AQ5UO7n7CJodBITSUNLtgAJqwSb6vCJMK4jIbVmf4nOxz9Jll7iiJD+WmnT6QFEePkMofFgJWAXN0NLksKXKm8ziY9Mpry9Dss4HQqLgPK85RzxLNM35D4x2xxzvuHFASc+V+qwq8+ZyJSgltlbtTTn1wnfTKAN+TUS8quK1jTPmqoY4kLMCg7ai08B5lWCwSF7z5gPquY3aAXW0ZEvdA9nrRCJMuWlCA5ZGO8KZafLI43F9+6TOB9jvojMQlqr+7bPmmNrinrkJXvTKfFCsLmRxMnFimX7FtpSB1UFoFmo1SV6LsciSEYRTl/vnfQLd2WtE7ijw1Fac0q5yBEm7o7tJDXtsvQRVwWrS6zkieM=
  ....
  .....

Output of pulumi about

pulumi version : v3.140.0
Language: Golang
Platform: AWS

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).

@KienKeng107 KienKeng107 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 22, 2024
@Frassle Frassle transferred this issue from pulumi/pulumi Nov 22, 2024
@t0yv0 t0yv0 added needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels Nov 25, 2024
@t0yv0
Copy link
Member

t0yv0 commented Nov 25, 2024

I can reproduce the problem - the difference is that the program contains the key material without the ending newline, but the provider somehow normalizes to adding a newline at the end. You can work around as follows for now:

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

const cfg = new pulumi.Config();

const pk = cfg.requireSecret("public_key")
    // Ensure that the key ends with a newline.
    .apply(s => s + "\n");

const publicKey = new aws.cloudfront.PublicKey("my-pk", {
    encodedKey: pk,
});

Once the newline is added there is no more permanent replace plans.

@t0yv0
Copy link
Member

t0yv0 commented Nov 25, 2024

I have filed an upstream issue as the Pulumi provider is inheriting this behavior from the Terraform provider. This could be best fixed upstream by using DiffSuppressFunc or similar functionality: hashicorp/terraform-provider-aws#40295

@t0yv0 t0yv0 added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). service/cloudfront and removed needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec service/cloudfront
Projects
None yet
Development

No branches or pull requests

2 participants