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

Empty Diff after import of org.rftemplate #45

Closed
zbuchheit opened this issue Aug 29, 2024 · 7 comments
Closed

Empty Diff after import of org.rftemplate #45

zbuchheit opened this issue Aug 29, 2024 · 7 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@zbuchheit
Copy link
Contributor

Describe what happened

When attempting to import an org.rftemplate I ran into an issue where it detects an empty diff after importing the resource. It appears the issue stems from the outputs having some default values that want to be added but bubble up as an empty diff.

Also, oddly enough, if I create the resource through pulumi, delete it from state, then re-import it, I won't get the empty diff. It only occurs with a fresh import of the resource.

It appears it is adding the defaults provided by the provider to the outputs for example, https://github.com/Juniper/terraform-provider-mist/blob/d21d5b42f4ee8b1fe1ba35936fc451bc2ac25905/internal/resource_org_rftemplate/org_rftemplate_resource_gen.go#L111

Sample program

  1. Import Rftemplate (manually create one, then import it)
  2. After the import run pulumi up
import * as pulumi from "@pulumi/pulumi";
import * as junipermist from "@pulumi/juniper-mist";

const config = new pulumi.Config();
const organizationId = config.requireSecret("organizationId");

const sites = junipermist.getSitesOutput({
  orgId: organizationId,
});

new junipermist.org.Rftemplate("tftemplate", {
  orgId: organizationId,
  name: "Test_Template",
  band24: {
    bandwidth: 20,
    powerMax: 18,
    powerMin: 8,
    preamble: "short",
  },
  band24Usage: "24",
  band5: {
    bandwidth: 40,
    powerMax: 17,
    powerMin: 8,
    preamble: "short",
  },
  band6: {
    bandwidth: 80,
    powerMax: 17,
    powerMin: 8,
    preamble: "short",
  },
});

Log output

N/A

Affected Resource(s)

org.Rftemplate

Output of pulumi about

Latest version of the provider 0.0.10

Additional context

Diff between resources in state after accepting the empty diff changes
--- stack_empty_diff.json	2024-08-28 16:47:29
+++ stack_after_up.json	2024-08-28 16:47:17
@@ -29,45 +29,60 @@
     "outputs": {
         "antGain24": 0,
         "antGain5": 0,
         "antGain6": 0,
         "band24": {
             "allowRrmDisable": false,
             "antGain": 0,
+            "antennaMode": "default",
             "bandwidth": 20,
             "channels": [],
             "disabled": false,
+            "power": 0,
             "powerMax": 18,
             "powerMin": 8,
             "preamble": "short"
         },
         "band24Usage": "24",
         "band5": {
             "allowRrmDisable": false,
             "antGain": 0,
+            "antennaMode": "default",
             "bandwidth": 40,
             "channels": [],
             "disabled": false,
+            "power": 0,
             "powerMax": 17,
             "powerMin": 8,
             "preamble": "short"
         },
         "band6": {
             "allowRrmDisable": false,
             "antGain": 0,
+            "antennaMode": "default",
             "bandwidth": 80,
             "channels": [],
             "disabled": false,
+            "power": 0,
             "powerMax": 17,
             "powerMin": 8,
-            "preamble": "short"
+            "preamble": "short",
+            "standardPower": false
         },
         "id": "redacted",
         "name": "Test_Template",
         "orgId": "redacted"
     },
     "parent": "urn:pulumi:dev::redacted-mist-issues::pulumi:pulumi:Stack::redacted-mist-issues-dev",
-    "protect": true,
     "provider": "urn:pulumi:dev::redacted-mist-issues::pulumi:providers:junipermist::default_0_0_10_github_/api.github.com/pulumi/pulumi-junipermist::841ba0d5-7342-420c-ae4b-4a2124a47cc3",
+    "propertyDependencies": {
+        "band24": [],
+        "band24Usage": [],
+        "band5": [],
+        "band6": [],
+        "name": [],
+        "orgId": []
+    },
     "created": "2024-08-28T22:40:47.716698Z",
-    "modified": "2024-08-28T22:40:47.716698Z"
+    "modified": "2024-08-28T23:26:57.054813Z",
+    "sourcePosition": "project:///index.ts#12,1"
 }
\ No newline at end of file

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

@zbuchheit zbuchheit added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 29, 2024
@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Aug 29, 2024
@iwahbe
Copy link
Member

iwahbe commented Aug 29, 2024

Hi @zbuchheit. Thanks for reporting this issue.

Do you know if this perma-diff reproduces in Terraform?

@zbuchheit
Copy link
Contributor Author

Looks like with TF it is functionally the same, but shows the diff changes it is wanting to do for state.

Terraform Output
 terraform plan
mist_org_rftemplate.rftemplate_one: Refreshing state... [id=redacted]

Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # mist_org_rftemplate.rftemplate_one will be updated in-place
  ~ resource "mist_org_rftemplate" "rftemplate_one" {
      ~ band_24       = {
          + antenna_mode      = "default"
          + power             = 0
            # (8 unchanged attributes hidden)
        }
      ~ band_5        = {
          + antenna_mode      = "default"
          + power             = 0
            # (8 unchanged attributes hidden)
        }
      ~ band_6        = {
          + antenna_mode      = "default"
          + power             = 0
          + standard_power    = false
            # (8 unchanged attributes hidden)
        }
      ~ id            = "redacted" -> (known after apply)
        name          = "Test_Template"
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

@iwahbe
Copy link
Member

iwahbe commented Aug 29, 2024

Awesome. Thanks for running that down.

This might be related to pulumi/pulumi-terraform-bridge#1501, where we are correctly discovering a diff (as TF does) but we are not displaying what is changing.

@zbuchheit
Copy link
Contributor Author

makes sense, I don't think it is functionally blocking, but wanted to make sure it was tracked and figured it would be a good example to help triage in the bridge.

@zbuchheit
Copy link
Contributor Author

this seems to be fixed in the latest release of the upstream provider

@pulumi-bot pulumi-bot reopened this Aug 30, 2024
@pulumi-bot
Copy link
Contributor

Cannot close issue:

  • does not have required labels: resolution/

Please fix these problems and try again.

@zbuchheit zbuchheit self-assigned this Aug 30, 2024
@zbuchheit zbuchheit added the resolution/fixed This issue was fixed label Aug 30, 2024
@zbuchheit
Copy link
Contributor Author

well, apparently I have to be taught this lesson 3 times today

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

No branches or pull requests

3 participants