pulumi / pulumi-pulumiservice

https://pulumi.com
Apache License 2.0
13 stars 6 forks source link

Fix environment input yaml type error panic #399

Closed seanyeh closed 1 month ago

seanyeh commented 1 month ago

This fixes the issue where creating esc resources with an older version of pulumi-pulumiservice and then using pulumi to do something with that resource on a newer version of pulumi-pulumiservice causes a panic due to a type error

We started loading input yamls as strings starting in https://github.com/pulumi/pulumi-pulumiservice/pull/391, but resources created before then will still be assets. This fix will check both the old and new way for backwards compatibility

Fixes https://github.com/pulumi/pulumi-pulumiservice/issues/400

Testing

Reproduction steps:

Without this change, you get an error that looks like:

 panic: interface conversion: interface {} is *asset.Asset, not string
    goroutine 45 [running]:
    github.com/pulumi/pulumi/sdk/v3/go/common/resource.PropertyValue.StringValue(...)
        /Users/sean/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.3-0.20240507143413-cffdfd1fa489/go/common/resource/properties.go:451
    github.com/pulumi/pulumi-pulumiservice/provider/pkg/provider.ToPulumiServiceEnvironmentInput(0x2?)
        /Users/sean/go/src/github.com/pulumi/pulumi-pulumiservice/provider/pkg/provider/environment.go:63 +0x1d0