pulumi/CHANGELOG_PENDING.md
Paul Stack f99b814f13
Ensure ResourceReference is included in printPropertyValue (#6962)
Fixes: #6934

With this snippet of code:

```
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create an AWS resource (S3 Bucket)
		vpc, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}

		rt, err := ec2.NewRouteTable(ctx, "example", &ec2.RouteTableArgs{
			VpcId: vpc.ID(),
		})

		// Export the name of the bucket
		ctx.Export("rt", rt)
		return nil
	})
}
```

the CLI would panic on the diff as follows:

```
panic: fatal: An assertion has failed

goroutine 249 [running]:
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
	/private/tmp/pulumi-20210422-70582-1bpvlru/sdk/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assert(...)
	/private/tmp/pulumi-20210422-70582-1bpvlru/sdk/go/common/util/contract/assert.go:26
github.com/pulumi/pulumi/pkg/v3/engine.printPropertyValue(0xc0005d41b0, 0x57cce00, 0xc001da9050, 0x0, 0x1, 0x5932853, 0x4, 0x0)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/engine/diff.go:511 +0x1485
```

This was due to the entire object being added to the output and
the property being a ResourceReference

On the changing of the code to use a switch statement, we can
now include the ResourceReference and ensure that we catch any
missing case statements with a panic as default

This means the same piece of code now outputs to the CLI as
follows:

```
Outputs:
    rt: {
        URN: "urn:pulumi:dev::testing-new-engine-diff::aws:ec2/routeTable:RouteTable::example"
        ID : "rtb-09b37608ec34f3b49"
        PackageVersion: ""
    }

Resources:
    3 unchanged

Duration: 2s
```
2021-05-04 19:34:28 +01:00

2.5 KiB

Breaking Changes

Enhancements

  • [auto/go] - Provide GetPermalink for all results #6875

  • [automation/*] Add support for getting stack outputs using Workspace #6859

  • [automation/*] Optionally skip Automation API version check #6882

    The version check can be skipped by passing a non-empty value to the PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK environment variable.

  • [codegen/python] Lazy module import to improve CLI startup performance #6827

  • [auto/go,nodejs] Add UserAgent to update/pre/refresh/destroy options. #6935

  • [plugins] - It is now possible to opt out of loading plugins present on PATH but not installed explicitly, by setting the PULUMI_IGNORE_AMBIENT_PLUGINS environment variable to any non-empty value.

Bug Fixes

  • [cli] Return an appropriate error when a user has not set PULUMI_CONFIG_PASSPHRASE nor PULUMI_CONFIG_PASSPHRASE_FILE when trying to access the Passphrase Secrets Manager #6893

  • [cli] Prevent against panic when using a ResourceReference as a program output #6962

  • [sdk/python] - Fix bug in MockResourceArgs. #6863

  • [automation/dotnet] Fix EventLogWatcher failing to read events after an exception was thrown #6821

  • [automation/dotnet] Use stackName in ImportStack #6858

  • [automation/go] Improve autoError message formatting #6924

  • [sdk/python] Address issues when using resource subclasses. #6890

  • [sdk/python] Fix type-related regression on Python 3.6. #6942

  • [sdk/python] Don't error when a dict input value has a mismatched type annotation. #6949

Misc.

  • [auto/dotnet] Bump YamlDotNet to 11.1.1 #6915

  • [sdk/dotnet] Enable deterministic builds #6917

  • [auto/*] - Bump minimum version to v3.1.0. #6852