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

NewNotificationChannel property diff for each run #875

Closed
raywonkari opened this issue Sep 13, 2024 · 9 comments · Fixed by #877
Closed

NewNotificationChannel property diff for each run #875

raywonkari opened this issue Sep 13, 2024 · 9 comments · Fixed by #877
Assignees
Labels
bug/diff kind/bug related to Pulumi generating wrong diffs on preview or up. kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@raywonkari
Copy link

Describe what happened

We create a webhook channel with a property info containing a payload, values etc. However after the initial deployment, subsequent pulumi up's show a terraform specific property popping up, which is not needed I guess. Perhaps the underlying terraform code is appending these fields.

Sample program

notificationChannel, err := newrelic.NewNotificationChannel(ctx, channelName, &newrelic.NotificationChannelArgs{
	AccountId:     pulumi.String(accountId),
	Name:          pulumi.String(channelName),
	Type:          pulumi.String("WEBHOOK"),
	DestinationId: pulumi.String(destinationId),
	Product:       pulumi.String("IINT"),
	Properties: newrelic.NotificationChannelPropertyArray{
		&newrelic.NotificationChannelPropertyArgs{
			Key:   pulumi.String("payload"),
			Value: pulumi.String(string(payload)),
		},
	},
})

pulumi diff (fields are masked)

      ~ properties: [
          ~ [0]: {
                  + __defaults  : []
                  - displayValue: ""
                  ~ key         : "source" => "payload"
                  - label       : "terraform-source-internal"
                  ~ value       :
                      - terraform
                      + xxxxxxxx
          - [1]: {
                  - displayValue: ""
                  - key         : "payload"
                  - label       : ""
                  - value       : xxxxxxxx

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

some fields are masked

CLI          
Version      3.131.0
Go Version   go1.23.0
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  archive     0.0.6
resource  aws         6.29.0
resource  aws-native  0.13.0
resource  cloudflare  5.16.0
resource  cloudflare  3.5.0
resource  command     0.11.1
resource  fastly      8.4.1
language  go          unknown
resource  kubernetes  4.9.1
resource  newrelic    5.31.0
resource  random      4.2.0
resource  tailscale   0.13.3

Host     
OS       darwin
Version  14.6.1
Arch     arm64

This project is written in go: executable='/opt/homebrew/bin/go' version='go version go1.22.2 darwin/arm64'

Current Stack: xxxxxxxxxxx

TYPE                       URN
pulumi:pulumi:Stack        urn:pulumi:newrelic::xxxxxxxx::pulumi:pulumi:Stack::xxxxxxxx-newrelic
pulumi:providers:newrelic  urn:pulumi:newrelic::xxxxxxxx::pulumi:providers:newrelic::default_5_31_0
pulumi:providers:newrelic  urn:pulumi:newrelic::xxxxxxxx::pulumi:providers:newrelic::default_5_17_0


Found no pending operations associated with newrelic

Backend        
Name           work.local
URL            s3://xxxxxxxx
User           raywonkari
Organizations  
Token type     personal

Dependencies:
NAME                                        VERSION
github.com/aws/aws-sdk-go-v2                v1.21.2
github.com/aws/aws-sdk-go-v2/config         v1.15.15
github.com/aws/aws-sdk-go-v2/service/ecs    v1.9.0
github.com/pulumi/pulumi-aws-native/sdk     v0.13.0
github.com/pulumi/pulumi-random/sdk/v4      v4.2.0
github.com/pulumi/pulumi/sdk/v3             v3.129.0
github.com/stretchr/testify                 v1.9.0
github.com/aws/aws-sdk-go                   v1.44.298
github.com/chartmogul/chartmogul-go/v3      v3.1.1
github.com/docker/docker                    v24.0.7+incompatible
github.com/go-git/go-git/v5                 v5.12.0
github.com/opencontainers/image-spec        v1.0.2
github.com/pulumi/pulumi-archive/sdk        v0.0.6
github.com/pulumi/pulumi-aws/sdk/v6         v6.29.0
github.com/pulumi/pulumi-cloudflare/sdk/v5  v5.16.0
github.com/pulumi/pulumi-command/sdk        v0.11.1
github.com/pulumi/pulumi-fastly/sdk/v8      v8.4.1
github.com/pulumi/pulumi-kubernetes/sdk/v4  v4.9.1
github.com/pulumi/pulumi-newrelic/sdk/v5    v5.31.0
github.com/pulumi/pulumi-tailscale/sdk      v0.13.3
github.com/tdewolff/minify/v2               v2.20.16
github.com/pulumi/pulumi-cloudflare/sdk/v3  v3.5.0

Pulumi locates its logs in /var/folders/m_/y8fbgmsd693cgpl3lh22hqth0000gn/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).

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

when we also look at the NR generated code from the console, we also see these fields
Image

@guineveresaenger
Copy link
Contributor

hi @raywonkari - thank you for filing this issue. We're sorry you're having trouble here and will take a look.

It does appear as though a TF property is leaking through - upstream seems to have a diff suppress function for this, but we don't seem to follow this pattern.

Do you happen to know if this behavior is a recent change? Meaning, were you using earlier versions of this provider and did not see this diff?

@guineveresaenger guineveresaenger added awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels Sep 13, 2024
@guineveresaenger guineveresaenger self-assigned this Sep 13, 2024
@guineveresaenger
Copy link
Contributor

hi again @raywonkari - I'm going to need a little help with a reproduction, as I'm not as familiar with the ins and outs of New Relic.

Specifically, can you provide us with a complete program that reproduces this issue you're seeing? This would help us address and root cause much more quickly.

@raywonkari
Copy link
Author

raywonkari commented Sep 16, 2024

Thanks @guineveresaenger, we have recently started using this method from the SDK, so I am not sure if this diffs are popping up now, or were there from the beginning.

The code pasted in the issue description should be good enough I think, we just have to create a new pulumi project and then paste that code in and apply, and then see a potential diff in the next run.. if you do not have a newrelic account, may be it is a bit tricky to reproduce I guess..

The only prerequisite is the destinationId, I guess for that, just create a new destination from new relic UI manually and then extract the ID.. It can be created by logging in to newrelic console -> Alerts -> Destinations -> Add a destination.

@pulumi-bot pulumi-bot added needs-triage Needs attention from the triage team and removed awaiting-feedback Blocked on input from the author labels Sep 16, 2024
@iwahbe
Copy link
Member

iwahbe commented Sep 16, 2024

@guineveresaenger I was able to reproduce with this program (and the providers.newrelic env):

package main

import (
	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() { pulumi.Run(Main) }

func Main(ctx *pulumi.Context) error {
	d, err := newrelic.NewNotificationDestination(ctx, "d", &newrelic.NotificationDestinationArgs{
		Properties: &newrelic.NotificationDestinationPropertyArray{},
		Type:       pulumi.String("WEBHOOK"),
	})
	if err != nil {
		return err
	}
	_, err = newrelic.NewNotificationChannel(ctx, "example", &newrelic.NotificationChannelArgs{
		Name:          pulumi.String("example"),
		Type:          pulumi.String("WEBHOOK"),
		DestinationId: d.ID(),
		Product:       pulumi.String("IINT"),
		Properties: newrelic.NotificationChannelPropertyArray{
			&newrelic.NotificationChannelPropertyArgs{
				Key:   pulumi.String("payload"),
				Value: pulumi.String("my-payload"),
			},
		},
	})
	return err
}

I see a perma-diff for both the notification destination and the notification channel.

@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 Sep 16, 2024
@iwahbe
Copy link
Member

iwahbe commented Sep 16, 2024

I have reproduced the above code in HCL and tested against the upstream TF provider. There is no perma-diff, indicating a bridge bug.

terraform {
  required_providers {
    newrelic = {
      source = "newrelic/newrelic"
    }
  }
}

resource "newrelic_notification_destination" "example" {
  name = "example"
  property {
    key   = "my-key"
    value = "my-value"
  }
  type = "WEBHOOK"
}

resource "newrelic_notification_channel" "example" {
  name           = "example"
  type           = "WEBHOOK"
  destination_id = newrelic_notification_destination.example.id
  product        = "IINT"
  property {
    key   = "payload"
    value = "my-payload"
  }
}

@iwahbe iwahbe added the awaiting/bridge The issue cannot be resolved without action in pulumi-terraform-bridge. label Sep 16, 2024
@t0yv0
Copy link
Member

t0yv0 commented Sep 17, 2024

Thank you for narrowing it down 🙏 Does the perma-diff in TF exist under -refrsh=false? Second question, on the Pulumi side, how does PlanResourceChange influence the result? Much appreciated.

@iwahbe
Copy link
Member

iwahbe commented Sep 17, 2024

Thank you for narrowing it down 🙏 Does the perma-diff in TF exist under -refrsh=false?

No. TF does not have the perma-diff regardless of refresh.

Second question, on the Pulumi side, how does PlanResourceChange influence the result? Much appreciated.

We don't have PRC turned on in this provider (CC @VenelinMartinov, I thought we had this rolled out to all providers).

PRC fixes the problem. Thanks for the suggestion.

@iwahbe iwahbe removed the awaiting/bridge The issue cannot be resolved without action in pulumi-terraform-bridge. label Sep 17, 2024
@iwahbe iwahbe self-assigned this Sep 17, 2024
@iwahbe iwahbe mentioned this issue Sep 17, 2024
@iwahbe iwahbe closed this as completed in 5a63c82 Sep 17, 2024
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Sep 17, 2024
@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #877 and shipped in release v5.32.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/diff kind/bug related to Pulumi generating wrong diffs on preview or up. kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants