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

Diff shown on pagerduty.Service without code changes #624

Open
ringods opened this issue Oct 1, 2024 · 4 comments
Open

Diff shown on pagerduty.Service without code changes #624

ringods 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

@ringods
Copy link
Member

ringods commented Oct 1, 2024

Describe what happened

  • Use the sample program below
  • run pulumi up to apply it
  • run pulumi up a second time without make any code changes

You will notice the following diff being proposed on the second up run:

  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:ringo::5906::pulumi:pulumi:Stack::5906-ringo]
    ~ pagerduty:index/service:Service: (update)
        [id=PSMWEVG]
        [urn=urn:pulumi:ringo::5906::pagerduty:index/service:Service::dummy-service]
        [provider=urn:pulumi:ringo::5906::pulumi:providers:pagerduty::default_4_14_6::9ff46ebd-cf6a-443b-85f6-63b8db97fe60]
      ~ incidentUrgencyRule: {
          + duringSupportHours : {
              + type      : "constant"
              + urgency   : "low"
            }
          + duringSupportHours : {
              + type      : "constant"
              + urgency   : "low"
            }
          + outsideSupportHours: {
              + type      : "constant"
              + urgency   : "low"
            }
          + outsideSupportHours: {
              + type      : "constant"
              + urgency   : "low"
            }
        }

A pulumi refresh proposes the following diff:

No resources will be modified as part of this refresh; just your stack's state will be.
 details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:ringo::5906::pulumi:pulumi:Stack::5906-ringo]
    ~ pagerduty:index/service:Service: (update)
        [id=PSMWEVG]
        [urn=urn:pulumi:ringo::5906::pagerduty:index/service:Service::dummy-service]
        [provider=urn:pulumi:ringo::5906::pulumi:providers:pagerduty::default_4_14_6::9ff46ebd-cf6a-443b-85f6-63b8db97fe60]
      ~ incidentUrgencyRule: {
          ~ outsideSupportHours: {
              - type   : <null>
              - urgency: <null>
            }
        }

Sample program

Replace the <email> placeholder in the pagerduty.User resource when using this program to test.

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

const testUser = new pagerduty.User("test-user", {
    name: "Earline Greenholt",
    email: "<email>",
});

const escalateViaEmail = new pagerduty.EscalationPolicy("escalate-via-email", {
    name: "Engineering Escalation Policy",
    numLoops: 2,
    rules: [{
        escalationDelayInMinutes: 10,
        targets: [{
            type: "user_reference",
            id: testUser.id,
        }],
    }],
});
const exampleService = new pagerduty.Service("dummy-service", {
    name: "MyDummy",
    description: 'PagerDuty service for My Dummy service',
    escalationPolicy: escalateViaEmail.id,
    // alertGroupingParameters: {
    //     type: 'intelligent',
    // },
    autoPauseNotificationsParameters: {
        enabled: true,
        timeout: 300,
    },
    autoResolveTimeout: "null",
    incidentUrgencyRule: {
        type: "constant",
        duringSupportHours: {
            type: "constant",
            urgency: "low",
        },
        outsideSupportHours: {
            type: "constant",
            urgency: "low",
        },
        urgency: "low",
    },
});

Log output

No response

Affected Resource(s)

pagerduty.Service

Output of pulumi about

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  14.6.1
Arch     arm64

This project is written in nodejs: executable='/Users/ringods/.volta/bin/node' version='v18.15.0'

Current Stack: team-ce/5906/ringo

TYPE                                               URN
pulumi:pulumi:Stack                                urn:pulumi:ringo::5906::pulumi:pulumi:Stack::5906-ringo
pulumi:providers:pagerduty                         urn:pulumi:ringo::5906::pulumi:providers:pagerduty::default_4_14_6
pagerduty:index/user:User                          urn:pulumi:ringo::5906::pagerduty:index/user:User::test-user
pagerduty:index/escalationPolicy:EscalationPolicy  urn:pulumi:ringo::5906::pagerduty:index/escalationPolicy:EscalationPolicy::escalate-via-email
pagerduty:index/service:Service                    urn:pulumi:ringo::5906::pagerduty:index/service:Service::dummy-service


Found no pending operations associated with team-ce/ringo

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/v-ringo-pulumi-corp
User           v-ringo-pulumi-corp
Organizations  v-ringo-pulumi-corp, team-ce
Token type     personal

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

Pulumi locates its logs in /var/folders/yq/10j1hf8s1ks9f23yxrdbbbb40000gn/T/ 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).

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

Thanks for reporting. I could repro the issue with the provided code. This might be a problem with the provider:

{
    "method": "/pulumirpc.ResourceProvider/Diff",
    "request": {
        "id": "P9Y95XU",
        "urn": "urn:pulumi:dev::pagerduty_624::pagerduty:index/service:Service::dummy-service",
        "olds": {
            "acknowledgementTimeout": "1800",
            "alertCreation": "create_alerts_and_incidents",
            "alertGrouping": null,
            "alertGroupingParameters": null,
            "alertGroupingTimeout": "null",
            "autoPauseNotificationsParameters": {
                "enabled": true,
                "timeout": 300
            },
            "autoResolveTimeout": "null",
            "createdAt": "2024-10-01T12:11:11+01:00",
            "description": "PagerDuty service for My Dummy service",
            "escalationPolicy": "PCX4X0Q",
            "htmlUrl": "https://pulumibot.pagerduty.com/service-directory/P9Y95XU",
            "id": "P9Y95XU",
            "incidentUrgencyRule": {
                "duringSupportHours": null,
                "outsideSupportHours": null,
                "type": "constant",
                "urgency": "low"
            },
            "lastIncidentTimestamp": "",
            "name": "MyDummy",
            "responsePlay": null,
            "scheduledActions": [],
            "status": "active",
            "supportHours": null,
            "type": "service"
        },
        "news": {
            "__defaults": [
                "acknowledgementTimeout"
            ],
            "acknowledgementTimeout": "1800",
            "autoPauseNotificationsParameters": {
                "__defaults": [],
                "enabled": true,
                "timeout": 300
            },
            "autoResolveTimeout": "null",
            "description": "PagerDuty service for My Dummy service",
            "escalationPolicy": "PCX4X0Q",
            "incidentUrgencyRule": {
                "__defaults": [],
                "duringSupportHours": {
                    "__defaults": [],
                    "type": "constant",
                    "urgency": "low"
                },
                "outsideSupportHours": {
                    "__defaults": [],
                    "type": "constant",
                    "urgency": "low"
                },
                "type": "constant",
                "urgency": "low"
            },
            "name": "MyDummy"
        },
        "oldInputs": {
            "__defaults": [
                "acknowledgementTimeout"
            ],
            "acknowledgementTimeout": "1800",
            "autoPauseNotificationsParameters": {
                "__defaults": [],
                "enabled": true,
                "timeout": 300
            },
            "autoResolveTimeout": "null",
            "description": "PagerDuty service for My Dummy service",
            "escalationPolicy": "PCX4X0Q",
            "incidentUrgencyRule": {
                "__defaults": [],
                "duringSupportHours": {
                    "__defaults": [],
                    "type": "constant",
                    "urgency": "low"
                },
                "outsideSupportHours": {
                    "__defaults": [],
                    "type": "constant",
                    "urgency": "low"
                },
                "type": "constant",
                "urgency": "low"
            },
            "name": "MyDummy"
        },
        "name": "dummy-service",
        "type": "pagerduty:index/service:Service"
    },
    "response": {
        "changes": "DIFF_SOME",
        "diffs": [
            "incidentUrgencyRule"
        ],
        "detailedDiff": {
            "incidentUrgencyRule.duringSupportHours": {
                "kind": "UPDATE"
            },
            "incidentUrgencyRule.duringSupportHours.type": {},
            "incidentUrgencyRule.duringSupportHours.urgency": {},
            "incidentUrgencyRule.outsideSupportHours": {
                "kind": "UPDATE"
            },
            "incidentUrgencyRule.outsideSupportHours.type": {},
            "incidentUrgencyRule.outsideSupportHours.urgency": {}
        },
        "hasDetailedDiff": true
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "pagerduty"
    }
}

The incidentUrgencyRules are not saved in the state and we correctly recognize a diff when previewing. I'll try to repro in TF.

@VenelinMartinov
Copy link
Contributor

Yeah, same thing in terraform:

terraform {
  required_providers {
    pagerduty = {
      source  = "pagerduty/pagerduty"
      version = ">= 2.2.1"
    }
  }
}

resource "pagerduty_user" "test_user" {
    name  = "Earline Greenholt"
    email = "<EMAIL>"
}

resource "pagerduty_escalation_policy" "escalate_via_email" {
    name     = "Engineering Escalation Policy"
    num_loops = 2

    rule {
        escalation_delay_in_minutes = 10

        target {
            type = "user_reference"
            id   = pagerduty_user.test_user.id
        }
    }
}

resource "pagerduty_service" "dummy_service" {
    name        = "MyDummy"
    description = "PagerDuty service for My Dummy service"
    
    escalation_policy = pagerduty_escalation_policy.escalate_via_email.id

    auto_pause_notifications_parameters {
        enabled = true
        timeout = 300
    }

    auto_resolve_timeout = null

    incident_urgency_rule {
        type = "constant"

        during_support_hours {
            type    = "constant"
            urgency = "low"
        }

        outside_support_hours {
            type    = "constant"
            urgency = "low"
        }

        urgency = "low"
    }
}

@VenelinMartinov
Copy link
Contributor

opened PagerDuty/terraform-provider-pagerduty#933 upstream

@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. labels Oct 1, 2024
@VenelinMartinov
Copy link
Contributor

As a workaround does ignoreChanges work for the field? @ringods

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

2 participants