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

Case sensitivity leads to unexpected replace plans #620

Open
t0yv0 opened this issue Jan 10, 2024 · 2 comments
Open

Case sensitivity leads to unexpected replace plans #620

t0yv0 opened this issue Jan 10, 2024 · 2 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). bug/diff kind/bug related to Pulumi generating wrong diffs on preview or up. kind/bug Some behavior is incorrect or out of spec

Comments

@t0yv0
Copy link
Member

t0yv0 commented Jan 10, 2024

What happened?

Noting that cloudflare.Zone normalizes the case to lowercase, but this leads to spurious diffs and replace plans when the program has an uppercase source. There are probably more resources like this.

Example

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

const config = new pulumi.Config();
const accountId = config.require("accountId");

const randomStr = new random.RandomString("random", {
    length: 8,
    overrideSpecial: "-",
    special: true,
    // upper: false, // TOGGLE THIS
});

const zone = new cloudflare.Zone("my-zone", {
    zone: randomStr.result.apply(r => `ts-test-cloudflare-${r}-zone.com`),
    accountId: accountId,
});

new cloudflare.Ruleset("transform_uri_rule_query", {
    description: "change the URI query to a new static query",
    kind: "zone",
    name: "transform rule for URI query parameter",
    phase: "http_request_transform",
    rules: [
        {
            action: "rewrite",
            actionParameters: {
                uri: {
                    query: {
                        value: "old=new_again2",
                    },
                },
            },
            description: "URI transformation query example",
            enabled: true,
            expression: 'http.host eq "test"',
        },
    ],
    zoneId: zone.id,
});

Output of pulumi about

CLI          
Version      3.99.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME        VERSION
cloudflare  5.17.0
nodejs      unknown
random      4.15.0

Host     
OS       darwin
Version  14.1.1
Arch     x86_64

This project is written in nodejs: executable='/Users/t0yv0/bin/node' version='v18.18.2'

Current Stack: t0yv0/regress-444/r444

TYPE                                    URN
pulumi:pulumi:Stack                     urn:pulumi:r444::regress-444::pulumi:pulumi:Stack::regress-444-r444
pulumi:providers:random                 urn:pulumi:r444::regress-444::pulumi:providers:random::default_4_15_0
random:index/randomString:RandomString  urn:pulumi:r444::regress-444::random:index/randomString:RandomString::random
pulumi:providers:cloudflare             urn:pulumi:r444::regress-444::pulumi:providers:cloudflare::default_5_17_0
cloudflare:index/zone:Zone              urn:pulumi:r444::regress-444::cloudflare:index/zone:Zone::my-zone
cloudflare:index/ruleset:Ruleset        urn:pulumi:r444::regress-444::cloudflare:index/ruleset:Ruleset::transform_uri_rule_query


Found no pending operations associated with r444

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/t0yv0
User           t0yv0
Organizations  t0yv0, pulumi
Token type     personal

Dependencies:
NAME                VERSION
@pulumi/random      4.15.0
@pulumi/cloudflare  5.17.0
@pulumi/pulumi      3.101.0

Pulumi locates its logs in /var/folders/gk/cchgxh512m72f_dmkcc3d09h0000gp/T/com.apple.shortcuts.mac-helper// by default

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

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jan 10, 2024
@t0yv0
Copy link
Member Author

t0yv0 commented Jan 10, 2024

#335 perhaps related

@iwahbe iwahbe added bug/diff kind/bug related to Pulumi generating wrong diffs on preview or up. and removed needs-triage Needs attention from the triage team labels Jan 12, 2024
@lukehoban
Copy link

This appears to be by design upstream. I expect upstream could/should add a DiffSuppressFunc that applies the same case normalization that Cloudflare itself does, extending what it currently uses in https://github.com/cloudflare/terraform-provider-cloudflare/blob/5708b23bf67f426ab2db43f0fad45a72c7b880ce/internal/sdkv2provider/resource_cloudflare_zone.go#L341.

@t0yv0 t0yv0 added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label Nov 11, 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). bug/diff kind/bug related to Pulumi generating wrong diffs on preview or up. kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants