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

Updates/previews want to reorder the events property for WebhookSubscription #625

Open
MitchellGerdisch opened this issue Oct 1, 2024 · 4 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. kind/bug Some behavior is incorrect or out of spec

Comments

@MitchellGerdisch
Copy link

Describe what happened

When running pulumi up or preview for a program that includes a pagerduty WebhookSubscription resource with a list of events specified (https://www.pulumi.com/registry/packages/pagerduty/api-docs/webhooksubscription/#events_nodejs) even though nothing has changed, pulumi shows a diff and wants to update the resource due to the events list property being reordered by the provider.

This results in a diff like this. Although a work-around may be to sort the events in alphabetical order to match what the provider or API returns, it seems like this should not be necessary and it should just work.

~ pagerduty:index/webhookSubscription:WebhookSubscription: (update)
        [urn=urn:pulumi:infra::pagerduty:index/webhookSubscription:WebhookSubscription::service-webhookSubscription]
        [provider=urn:pulumi:infra::pulumi:providers:pagerduty::pagerduty-webhook-provider::dbdafs-bc98-4d8b-9c19-ad97919a00b6]
      ~ events: [
          ~ [0]: "incident.acknowledged" => "incident.triggered"
          ~ [1]: "incident.delegated" => "incident.acknowledged"
          ~ [2]: "incident.resolved" => "incident.unacknowledged"
          ~ [3]: "incident.triggered" => "incident.delegated"
          ~ [4]: "incident.unacknowledged" => "incident.resolved"
        ]

Sample program

To reproduce, run pulumi up twice or more times for the following program.
You will see that the second and later updates always show a diff because the acknowledged event is out of alphabetical order.

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

const example = pagerduty.getService({
    name: "MyDummy",
});
const foo = new pagerduty.WebhookSubscription("foo", {
    deliveryMethods: [{
        type: "http_delivery_method",
        url: "https://example.com/receive_a_pagerduty_webhook",
        customHeaders: [
            {
                name: "X-Foo",
                value: "foo",
            },
            {
                name: "X-Bar",
                value: "bar",
            },
        ],
    }],
    description: "%s",
    events: [
        "incident.annotated",
        "incident.acknowledged",
        "incident.delegated",
        "incident.escalated",
        "incident.priority_updated",
        "incident.reassigned",
        "incident.reopened",
        "incident.resolved",
        "incident.responder.added",
        "incident.responder.replied",
        "incident.status_update_published",
        "incident.triggered",
        "incident.unacknowledged",
    ],
    active: true,
    filters: [{
        id: example.then(example => example.id),
        type: "service_reference",
    }],
    type: "webhook_subscription",
});

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

CLI
Version 3.134.1
Go Version go1.23.1
Go Compiler gc

Plugins
KIND NAME VERSION
language nodejs unknown
resource pagerduty 4.14.6

Host
OS darwin
Version 13.6.9
Arch x86_64

This project is written in nodejs: executable='/Users/mitch/.nvm/versions/node/v20.10.0/bin/node' version='v20.10.0'

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name pulumi.com

Dependencies:
NAME VERSION
@pulumi/pagerduty 4.14.6
@pulumi/pulumi 3.134.1
@types/node 18.19.54
typescript 5.6.2

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

@MitchellGerdisch MitchellGerdisch added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 1, 2024
@MitchellGerdisch
Copy link
Author

FYI, This also happens with Python.

@VenelinMartinov
Copy link
Contributor

Thanks for reporting @MitchellGerdisch, I've reproduced this upstream and raised an issue: PagerDuty/terraform-provider-pagerduty#934

For anyone affected, the workaround as @MitchellGerdisch noted is to rearrange the property inputs to be alphabetical.

@VenelinMartinov VenelinMartinov added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). blocked The issue cannot be resolved without 3rd party action. and removed needs-triage Needs attention from the triage team labels Oct 2, 2024
@joeduffy
Copy link
Member

joeduffy commented Oct 19, 2024

@VenelinMartinov Is the upstream bug correct? It looks like the template, not the actual issue, in the body of the issue, unless I’m misunderstanding something.

@VenelinMartinov
Copy link
Contributor

@joeduffy thanks for pointing it out. I had left the template questions along with my repro steps, making it a bit hard to read. I've editted the upstream issue to leave only the relevant bits now.

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). blocked The issue cannot be resolved without 3rd party action. kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants