From 9660285faa9af040d13361e2c9c5c4d96cfd0716 Mon Sep 17 00:00:00 2001 From: VenelinMartinov Date: Wed, 15 Jan 2025 14:18:35 +0200 Subject: [PATCH] SDKv2 Diff tests for primitive types (#2829) This PR finishes the test coverage for primitive types (string, bool, int and float) for the SDKv2 bridge for Diff. [14807c6](https://github.com/pulumi/pulumi-terraform-bridge/pull/2829/commits/14807c6c3718fdb4e185df32df21b88fbaf1553b) and [8552a4a](https://github.com/pulumi/pulumi-terraform-bridge/pull/2829/commits/8552a4a7757fbbf0f2654689a335ac61a80b93ab) contain the test recordings. fixes https://github.com/pulumi/pulumi-terraform-bridge/issues/2786 --- ...diff_test.go => detailed_diff_map_test.go} | 52 ----- .../diff_test/detailed_diff_primitive_test.go | 48 +++++ .../optional/added.golden | 31 +++ .../optional/changed.golden | 31 +++ .../optional}/removed.golden | 10 +- .../optional/unchanged_empty.golden | 15 ++ .../optional/unchanged_non-empty.golden | 15 ++ .../optionalComputed/added.golden | 15 ++ .../optionalComputed/changed.golden | 31 +++ .../optionalComputed/removed.golden | 31 +++ .../optionalComputed/unchanged_empty.golden | 31 +++ .../unchanged_non-empty.golden | 15 ++ .../optionalComputedForceNew/added.golden | 15 ++ .../optionalComputedForceNew/changed.golden | 31 +++ .../optionalComputedForceNew/removed.golden | 31 +++ .../unchanged_empty.golden | 31 +++ .../unchanged_non-empty.golden | 15 ++ .../optionalDefault/added.golden | 31 +++ .../optionalDefault/changed.golden | 31 +++ .../optionalDefault/removed.golden | 31 +++ .../optionalDefault/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalDefaultForceNew/added.golden | 31 +++ .../optionalDefaultForceNew/changed.golden | 31 +++ .../optionalDefaultForceNew/removed.golden | 31 +++ .../unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalForceNew/added.golden | 31 +++ .../optionalForceNew/changed.golden | 31 +++ .../optionalForceNew/removed.golden | 31 +++ .../optionalForceNew/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../required/added.golden | 31 +++ .../required/changed.golden | 31 +++ .../required/removed.golden | 31 +++ .../required/unchanged_empty.golden | 15 ++ .../required/unchanged_non-empty.golden | 15 ++ .../requiredForceNew/added.golden | 31 +++ .../requiredForceNew/changed.golden | 31 +++ .../requiredForceNew/removed.golden | 31 +++ .../requiredForceNew/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optional/added.golden | 32 +++ .../optional/changed.golden | 32 +++ .../optional/removed.golden | 32 +++ .../optional/unchanged_empty.golden | 16 ++ .../optional/unchanged_non-empty.golden | 16 ++ .../optionalComputed/added.golden | 32 +++ .../optionalComputed/changed.golden | 32 +++ .../optionalComputed/removed.golden | 32 +++ .../optionalComputed/unchanged_empty.golden | 32 +++ .../unchanged_non-empty.golden | 16 ++ .../optionalComputedForceNew/added.golden | 32 +++ .../optionalComputedForceNew/changed.golden | 32 +++ .../optionalComputedForceNew/removed.golden | 32 +++ .../unchanged_empty.golden | 32 +++ .../unchanged_non-empty.golden | 16 ++ .../optionalDefault/added.golden | 32 +++ .../optionalDefault/changed.golden | 32 +++ .../optionalDefault/removed.golden | 32 +++ .../optionalDefault/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../optionalDefaultForceNew/added.golden | 32 +++ .../optionalDefaultForceNew/changed.golden | 32 +++ .../optionalDefaultForceNew/removed.golden | 32 +++ .../unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../optionalForceNew/added.golden | 32 +++ .../optionalForceNew/changed.golden | 32 +++ .../optionalForceNew/removed.golden | 32 +++ .../optionalForceNew/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../required/added.golden | 32 +++ .../required/changed.golden | 32 +++ .../required/removed.golden | 32 +++ .../required/unchanged_empty.golden | 16 ++ .../required/unchanged_non-empty.golden | 16 ++ .../requiredForceNew/added.golden | 32 +++ .../requiredForceNew/changed.golden | 32 +++ .../requiredForceNew/removed.golden | 32 +++ .../requiredForceNew/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../optional/added.golden | 32 +++ .../optional/changed.golden | 32 +++ .../optional/removed.golden | 32 +++ .../optional/unchanged_empty.golden | 16 ++ .../optional/unchanged_non-empty.golden | 16 ++ .../optionalComputed/added.golden | 32 +++ .../optionalComputed/changed.golden | 32 +++ .../optionalComputed/removed.golden | 32 +++ .../optionalComputed/unchanged_empty.golden | 32 +++ .../unchanged_non-empty.golden | 16 ++ .../optionalComputedForceNew/added.golden | 32 +++ .../optionalComputedForceNew/changed.golden | 32 +++ .../optionalComputedForceNew/removed.golden | 32 +++ .../unchanged_empty.golden | 32 +++ .../unchanged_non-empty.golden | 16 ++ .../optionalDefault/added.golden | 32 +++ .../optionalDefault/changed.golden | 32 +++ .../optionalDefault/removed.golden | 32 +++ .../optionalDefault/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../optionalDefaultForceNew/added.golden | 32 +++ .../optionalDefaultForceNew/changed.golden | 32 +++ .../optionalDefaultForceNew/removed.golden | 32 +++ .../unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../optionalForceNew/added.golden | 32 +++ .../optionalForceNew/changed.golden | 32 +++ .../optionalForceNew/removed.golden | 32 +++ .../optionalForceNew/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../required/added.golden | 32 +++ .../required/changed.golden | 32 +++ .../required/removed.golden | 32 +++ .../required/unchanged_empty.golden | 16 ++ .../required/unchanged_non-empty.golden | 16 ++ .../requiredForceNew/added.golden | 32 +++ .../requiredForceNew/changed.golden | 32 +++ .../requiredForceNew/removed.golden | 32 +++ .../requiredForceNew/unchanged_empty.golden | 16 ++ .../unchanged_non-empty.golden | 16 ++ .../{ => optional}/added.golden | 10 +- .../{ => optional}/changed.golden | 8 +- .../optional/removed.golden | 31 +++ .../{ => optional}/unchanged_empty.golden | 2 +- .../{ => optional}/unchanged_non-empty.golden | 0 .../optionalComputed/added.golden | 31 +++ .../optionalComputed/changed.golden | 31 +++ .../optionalComputed/removed.golden | 15 ++ .../optionalComputed/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalComputedForceNew/added.golden | 31 +++ .../optionalComputedForceNew/changed.golden | 31 +++ .../optionalComputedForceNew/removed.golden | 15 ++ .../unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalDefault/added.golden | 31 +++ .../optionalDefault/changed.golden | 31 +++ .../optionalDefault/removed.golden | 31 +++ .../optionalDefault/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalDefaultForceNew/added.golden | 31 +++ .../optionalDefaultForceNew/changed.golden | 31 +++ .../optionalDefaultForceNew/removed.golden | 31 +++ .../unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../optionalForceNew/added.golden | 31 +++ .../optionalForceNew/changed.golden | 31 +++ .../optionalForceNew/removed.golden | 31 +++ .../optionalForceNew/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ .../required/added.golden | 31 +++ .../required/changed.golden | 31 +++ .../required/removed.golden | 31 +++ .../required/unchanged_empty.golden | 15 ++ .../required/unchanged_non-empty.golden | 15 ++ .../requiredForceNew/added.golden | 31 +++ .../requiredForceNew/changed.golden | 31 +++ .../requiredForceNew/removed.golden | 31 +++ .../requiredForceNew/unchanged_empty.golden | 15 ++ .../unchanged_non-empty.golden | 15 ++ pkg/tests/diff_test/value_makers.go | 188 +++++++++++++++++- 163 files changed, 4175 insertions(+), 68 deletions(-) rename pkg/tests/diff_test/{detailed_diff_test.go => detailed_diff_map_test.go} (61%) create mode 100644 pkg/tests/diff_test/detailed_diff_primitive_test.go create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden rename pkg/tests/diff_test/testdata/{TestSDKv2DetailedDiffString => TestSDKv2DetailedDiffBool/optional}/removed.golden (75%) create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/added.golden (77%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/changed.golden (80%) create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/unchanged_empty.golden (86%) rename pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/{ => optional}/unchanged_non-empty.golden (100%) create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden create mode 100644 pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden diff --git a/pkg/tests/diff_test/detailed_diff_test.go b/pkg/tests/diff_test/detailed_diff_map_test.go similarity index 61% rename from pkg/tests/diff_test/detailed_diff_test.go rename to pkg/tests/diff_test/detailed_diff_map_test.go index 309cc2170..f632f85b3 100644 --- a/pkg/tests/diff_test/detailed_diff_test.go +++ b/pkg/tests/diff_test/detailed_diff_map_test.go @@ -10,58 +10,6 @@ import ( crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" ) -func TestSDKv2DetailedDiffString(t *testing.T) { - t.Parallel() - - res := schema.Resource{ - Schema: map[string]*schema.Schema{ - "string_prop": { - Type: schema.TypeString, - Optional: true, - }, - }, - } - - valueOne := ref("val1") - valueTwo := ref("val2") - var noValue *string - - ctyVal := func(v *string) map[string]cty.Value { - if v == nil { - return map[string]cty.Value{} - } - return map[string]cty.Value{ - "string_prop": cty.StringVal(*v), - } - } - - scenarios := []struct { - name string - initialValue *string - changeValue *string - }{ - {"unchanged empty", noValue, noValue}, - {"unchanged non-empty", valueOne, valueOne}, - {"added", noValue, valueOne}, - {"removed", valueOne, noValue}, - {"changed", valueOne, valueTwo}, - } - - for _, scenario := range scenarios { - t.Run(scenario.name, func(t *testing.T) { - t.Parallel() - diff := crosstests.Diff(t, &res, ctyVal(scenario.initialValue), ctyVal(scenario.changeValue)) - autogold.ExpectFile(t, testOutput{ - initialValue: scenario.initialValue, - changeValue: scenario.changeValue, - tfOut: diff.TFOut, - pulumiOut: diff.PulumiOut, - detailedDiff: diff.PulumiDiff.DetailedDiff, - }) - }) - } -} - func TestSDKv2DetailedDiffMap(t *testing.T) { t.Parallel() diff --git a/pkg/tests/diff_test/detailed_diff_primitive_test.go b/pkg/tests/diff_test/detailed_diff_primitive_test.go new file mode 100644 index 000000000..cf684ec93 --- /dev/null +++ b/pkg/tests/diff_test/detailed_diff_primitive_test.go @@ -0,0 +1,48 @@ +package tests + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/zclconf/go-cty/cty" +) + +func TestSDKv2DetailedDiffString(t *testing.T) { + t.Parallel() + + var nilVal string + schemaValueMakerPairs, scenarios := generateBaseTests( + schema.TypeString, cty.StringVal, "val1", "val2", "computed", "default", nilVal) + + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) +} + +func TestSDKv2DetailedDiffBool(t *testing.T) { + t.Parallel() + + var nilVal bool + schemaValueMakerPairs, scenarios := generateBaseTests( + schema.TypeBool, cty.BoolVal, true, false, true, false, nilVal) + + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) +} + +func TestSDKv2DetailedDiffInt(t *testing.T) { + t.Parallel() + + var nilVal int64 + schemaValueMakerPairs, scenarios := generateBaseTests( + schema.TypeInt, cty.NumberIntVal, 1, 2, 3, 4, nilVal) + + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) +} + +func TestSDKv2DetailedDiffFloat(t *testing.T) { + t.Parallel() + + var nilVal float64 + schemaValueMakerPairs, scenarios := generateBaseTests( + schema.TypeFloat, cty.NumberFloatVal, 1.0, 2.0, 3.0, 4.0, nilVal) + + runSDKv2TestMatrix(t, schemaValueMakerPairs, scenarios) +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden similarity index 75% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/removed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden index e57708505..564920693 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/removed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/removed.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: valast.Ptr("val1"), changeValue: nil, + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - - string_prop = "val1" -> null + id = "newid" + ~ prop = true -> false } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - - stringProp: "val1" + ~ prop: true => false Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "DELETE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optional/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden new file mode 100644 index 000000000..c4701d306 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/added.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden new file mode 100644 index 000000000..5f507c6b3 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden new file mode 100644 index 000000000..5f507c6b3 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..faa41da3d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_empty.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..c4701d306 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/added.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..20b509a2c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..20b509a2c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..21e7d83be --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden new file mode 100644 index 000000000..cf38f6a37 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = false -> true + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden new file mode 100644 index 000000000..564920693 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = true -> false + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/required/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden new file mode 100644 index 000000000..15dcbecee --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(true), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = false -> true # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: false => true +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden new file mode 100644 index 000000000..b4e804ab5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(false), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = true -> false # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: true => false +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..96e43c9b8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(false), changeValue: valast.Ptr(false), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..706b6da68 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffBool/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(true), changeValue: valast.Ptr(true), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optional/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden new file mode 100644 index 000000000..7ecf8f96a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden new file mode 100644 index 000000000..301fd66fc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden new file mode 100644 index 000000000..f7df7690b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..203f3e467 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..8d95a4556 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..31c7358fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..a27e88235 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..0e58c49fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden new file mode 100644 index 000000000..cfad67fbc --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden new file mode 100644 index 000000000..198764dfe --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden new file mode 100644 index 000000000..04796494b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/required/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden new file mode 100644 index 000000000..0aa06cbd0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden new file mode 100644 index 000000000..330e15834 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden new file mode 100644 index 000000000..42cd5eb89 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..1cd310bac --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(0)), + changeValue: valast.Ptr(float64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..fa2c69d67 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffFloat/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(float64(1)), + changeValue: valast.Ptr(float64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optional/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden new file mode 100644 index 000000000..094ac1be0 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden new file mode 100644 index 000000000..8143d2da5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden new file mode 100644 index 000000000..2a33bbd30 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..5450a0ee5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = 3 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..8100f7b6f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..186276491 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..d94315fd4 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..6710e22dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = 3 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 3 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden new file mode 100644 index 000000000..eb372e44d --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 0 -> 1 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden new file mode 100644 index 000000000..f0564af44 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 2 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden new file mode 100644 index 000000000..32ac766b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = 1 -> 0 + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/required/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden new file mode 100644 index 000000000..57bb555b7 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/added.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 0 -> 1 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 0 => 1 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden new file mode 100644 index 000000000..553434587 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/changed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(2)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 2 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 2 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden new file mode 100644 index 000000000..4f9a5c0fd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/removed.golden @@ -0,0 +1,32 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = 1 -> 0 # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: 1 => 0 +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..b2d49b145 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(0)), + changeValue: valast.Ptr(int64(0)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..ff4a6371a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffInt/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,16 @@ +tests.testOutput{ + initialValue: valast.Ptr(int64(1)), + changeValue: valast.Ptr(int64(1)), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden similarity index 77% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/added.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden index 94ba38c16..020e01e29 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/added.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/added.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: valast.Ptr("val1"), + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), tfOut: ` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - + string_prop = "val1" + id = "newid" + + prop = "val1" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - + stringProp: "val1" + + prop: "val1" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden similarity index 80% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/changed.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden index d32fc8650..3f412d2d5 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/changed.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/changed.golden @@ -9,8 +9,8 @@ Terraform will perform the following actions: # crossprovider_test_res.example will be updated in-place ~ resource "crossprovider_test_res" "example" { - id = "newid" - ~ string_prop = "val1" -> "val2" + id = "newid" + ~ prop = "val1" -> "val2" } Plan: 0 to add, 1 to change, 0 to destroy. @@ -22,10 +22,10 @@ Plan: 0 to add, 1 to change, 0 to destroy. ~ crossprovider:index/testRes:TestRes: (update) [id=newid] [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] - ~ stringProp: "val1" => "val2" + ~ prop: "val1" => "val2" Resources: ~ 1 to update 1 unchanged `, - detailedDiff: map[string]interface{}{"stringProp": map[string]interface{}{"kind": "UPDATE"}}, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, } diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden new file mode 100644 index 000000000..6d6cd3873 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + - prop = "val1" -> null + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden similarity index 86% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden index 53d2a9794..a55e0790a 100644 --- a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_empty.golden +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_empty.golden @@ -1,5 +1,5 @@ tests.testOutput{ - initialValue: nil, changeValue: nil, + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), tfOut: ` No changes. Your infrastructure matches the configuration. diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_non-empty.golden similarity index 100% rename from pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/unchanged_non-empty.golden rename to pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optional/unchanged_non-empty.golden diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden new file mode 100644 index 000000000..b81c5b64c --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = "computed" -> "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "computed" => "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden new file mode 100644 index 000000000..c0073f39b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "id" + ~ prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden new file mode 100644 index 000000000..8a0ae1c46 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/removed.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputed/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden new file mode 100644 index 000000000..360c94faa --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = "computed" -> "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "computed" => "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden new file mode 100644 index 000000000..81ed8eb9b --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "id" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=id] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden new file mode 100644 index 000000000..8a0ae1c46 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/removed.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalComputedForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden new file mode 100644 index 000000000..020e01e29 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + prop = "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden new file mode 100644 index 000000000..3f412d2d5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden new file mode 100644 index 000000000..6d6cd3873 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + - prop = "val1" -> null + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefault/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden new file mode 100644 index 000000000..009b6d471 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden new file mode 100644 index 000000000..58402aee8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden new file mode 100644 index 000000000..deef631dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalDefaultForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden new file mode 100644 index 000000000..009b6d471 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden new file mode 100644 index 000000000..58402aee8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden new file mode 100644 index 000000000..deef631dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/optionalForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden new file mode 100644 index 000000000..020e01e29 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + + prop = "val1" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden new file mode 100644 index 000000000..3f412d2d5 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + ~ prop = "val1" -> "val2" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden new file mode 100644 index 000000000..6d6cd3873 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +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: + + # crossprovider_test_res.example will be updated in-place + ~ resource "crossprovider_test_res" "example" { + id = "newid" + - prop = "val1" -> null + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + ~ crossprovider:index/testRes:TestRes: (update) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + ~ 1 to update + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/required/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden new file mode 100644 index 000000000..009b6d471 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/added.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr("val1"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + + prop = "val1" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + + prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden new file mode 100644 index 000000000..58402aee8 --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/changed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val2"), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + ~ prop = "val1" -> "val2" # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + ~ prop: "val1" => "val2" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden new file mode 100644 index 000000000..deef631dd --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/removed.golden @@ -0,0 +1,31 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr(""), + tfOut: ` +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: ++/- create replacement and then destroy + +Terraform will perform the following actions: + + # crossprovider_test_res.example must be replaced ++/- resource "crossprovider_test_res" "example" { + ~ id = "newid" -> (known after apply) + - prop = "val1" -> null # forces replacement + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] + +-crossprovider:index/testRes:TestRes: (replace) + [id=newid] + [urn=urn:pulumi:test::project::crossprovider:index/testRes:TestRes::example] + - prop: "val1" +Resources: + +-1 to replace + 1 unchanged +`, + detailedDiff: map[string]interface{}{"prop": map[string]interface{}{"kind": "UPDATE_REPLACE"}}, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden new file mode 100644 index 000000000..a55e0790a --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr(""), changeValue: valast.Ptr(""), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden new file mode 100644 index 000000000..25581866f --- /dev/null +++ b/pkg/tests/diff_test/testdata/TestSDKv2DetailedDiffString/requiredForceNew/unchanged_non-empty.golden @@ -0,0 +1,15 @@ +tests.testOutput{ + initialValue: valast.Ptr("val1"), changeValue: valast.Ptr("val1"), + tfOut: ` +No changes. Your infrastructure matches the configuration. + +Terraform has compared your real infrastructure against your configuration +and found no differences, so no changes are needed. +`, + pulumiOut: `Previewing update (test): + pulumi:pulumi:Stack: (same) + [urn=urn:pulumi:test::project::pulumi:pulumi:Stack::project-test] +Resources: + 2 unchanged +`, +} diff --git a/pkg/tests/diff_test/value_makers.go b/pkg/tests/diff_test/value_makers.go index fcb44f6eb..50b2924f8 100644 --- a/pkg/tests/diff_test/value_makers.go +++ b/pkg/tests/diff_test/value_makers.go @@ -1,11 +1,197 @@ package tests -import "github.com/zclconf/go-cty/cty" +import ( + "context" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hexops/autogold/v2" + "github.com/zclconf/go-cty/cty" + + crosstests "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/internal/tests/cross-tests" +) func ref[T any](v T) *T { return &v } +type diffSchemaValueMakerPair[T any] struct { + name string + schema schema.Resource + valueMaker func(v *T) map[string]cty.Value +} + +type diffScenario[T any] struct { + name string + initialValue *T + changeValue *T +} + +func runSDKv2TestMatrix[T any]( + t *testing.T, schemaValueMakerPairs []diffSchemaValueMakerPair[T], scenarios []diffScenario[T], +) { + for _, schemaValueMakerPair := range schemaValueMakerPairs { + t.Run(schemaValueMakerPair.name, func(t *testing.T) { + t.Parallel() + for _, scenario := range scenarios { + t.Run(scenario.name, func(t *testing.T) { + t.Parallel() + if strings.Contains(schemaValueMakerPair.name, "required") && + (scenario.initialValue == nil || scenario.changeValue == nil) { + t.Skip("Required fields cannot be unset") + } + diff := crosstests.Diff( + t, &schemaValueMakerPair.schema, schemaValueMakerPair.valueMaker(scenario.initialValue), + schemaValueMakerPair.valueMaker(scenario.changeValue)) + autogold.ExpectFile(t, testOutput{ + initialValue: scenario.initialValue, + changeValue: scenario.changeValue, + tfOut: diff.TFOut, + pulumiOut: diff.PulumiOut, + detailedDiff: diff.PulumiDiff.DetailedDiff, + }) + }) + } + }) + } +} + +func generateBaseTests[T any]( + typ schema.ValueType, ctyMaker func(v T) cty.Value, val1, val2, computedVal, defaultVal, nilVal T, +) ([]diffSchemaValueMakerPair[T], []diffScenario[T]) { + valueOne := ref(val1) + valueTwo := ref(val2) + noValue := ref(nilVal) + + ctyVal := func(v *T) map[string]cty.Value { + if v == nil { + return map[string]cty.Value{} + } + return map[string]cty.Value{ + "prop": ctyMaker(*v), + } + } + + optionalSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + }, + }, + } + + optionalForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + ForceNew: true, + }, + }, + } + + requiredSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Required: true, + }, + }, + } + + requiredForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + ForceNew: true, + Required: true, + }, + }, + } + + setComputedFunc := func(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + if _, ok := d.GetOk("prop"); !ok { + err := d.Set("prop", computedVal) + if err != nil { + return diag.FromErr(err) + } + } + return nil + } + + optionalComputedSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Computed: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalComputedForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { + rd.SetId("id") + return setComputedFunc(ctx, rd, i) + }, + UpdateContext: setComputedFunc, + } + + optionalDefaultSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Default: defaultVal, + }, + }, + } + + optionalDefaultForceNewSchema := schema.Resource{ + Schema: map[string]*schema.Schema{ + "prop": { + Type: typ, + Optional: true, + Default: defaultVal, + ForceNew: true, + }, + }, + } + + return []diffSchemaValueMakerPair[T]{ + {"optional", optionalSchema, ctyVal}, + {"optionalForceNew", optionalForceNewSchema, ctyVal}, + {"required", requiredSchema, ctyVal}, + {"requiredForceNew", requiredForceNewSchema, ctyVal}, + {"optionalComputed", optionalComputedSchema, ctyVal}, + {"optionalComputedForceNew", optionalComputedForceNewSchema, ctyVal}, + {"optionalDefault", optionalDefaultSchema, ctyVal}, + {"optionalDefaultForceNew", optionalDefaultForceNewSchema, ctyVal}, + }, []diffScenario[T]{ + {"unchanged empty", noValue, noValue}, + {"unchanged non-empty", valueOne, valueOne}, + {"added", noValue, valueOne}, + {"removed", valueOne, noValue}, + {"changed", valueOne, valueTwo}, + } +} + func listValueMaker(arr *[]string) cty.Value { if arr == nil { return cty.NullVal(cty.DynamicPseudoType)