pulumi / pulumi-pulumiservice

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

panic in the latest version of the pulumi service has a bug with the Environment yaml field. #418

Closed firemanxbr closed 1 month ago

firemanxbr commented 1 month ago

What happened?

The latest version of the pulumi service has a bug with the Environment yaml field.

Diagnostics:
  pulumiservice:index:Environment (gcp-non-prod):
    error: error reading from server: EOF

  pulumi:pulumi:Stack (iac-gcp-non-prod-green):
    panic: interface conversion: interface {} is string, not *asset.Asset
    goroutine 16 [running]:
    github.com/pulumi/pulumi/sdk/v3/go/common/resource.PropertyValue.AssetValue(...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.131.0/go/common/resource/properties.go:456
    github.com/pulumi/pulumi-pulumiservice/provider/pkg/provider.(*PulumiServiceEnvironmentResource).Check(0x10528efe8?, 0x14000156540?)
        /home/runner/work/pulumi-pulumiservice/pulumi-pulumiservice/provider/pkg/provider/environment.go:243 +0x6f8
    github.com/pulumi/pulumi-pulumiservice/provider/pkg/provider.(*pulumiserviceProvider).Check(0x1400004e600, {0x104b8d9c4?, 0x40?}, 0x1050a36e0?)
        /home/runner/work/pulumi-pulumiservice/pulumi-pulumiservice/provider/pkg/provider/provider.go:217 +0xe4
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Check_Handler.func1({0x10529df98, 0x14000694360}, {0x1051ddc20?, 0x14000156540})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.131.0/proto/go/provider_grpc.pb.go:615 +0x74
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x10529df98, 0x14000694180}, {0x1051ddc20, 0x14000156540}, 0x140003c8020, 0x14000494030)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x2e8
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Check_Handler({0x105241ce0?, 0x1400004e600}, {0x10529df98, 0x14000694180}, 0x140001c6a00, 0x14000610140)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.131.0/proto/go/provider_grpc.pb.go:617 +0x12c
    google.golang.org/grpc.(*Server).processUnaryRPC(0x14000628000, {0x10529df98, 0x14000694030}, {0x1052a6de0, 0x140002c6780}, 0x14000000900, 0x1400078e4e0, 0x105a5f988, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xba0
    google.golang.org/grpc.(*Server).handleStream(0x14000628000, {0x1052a6de0, 0x140002c6780}, 0x14000000900)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xc80
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 29
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x150

Example

env_json = pulumi.Output.json_dumps(
        {
            "values": {
                "gcp": {
                    "login": {
                        "fn::open::gcp-login": {
                            "project": int(project_id),
                            "oidc": {
                                "workloadPoolId": identity_provider.workload_identity_pool_id,
                                "providerId": identity_provider.workload_identity_pool_provider_id,
                                "serviceAccount": service_account.email,
                            },
                        },
                    },
                },
                "environmentVariables": {
                    "GOOGLE_PROJECT": "${gcp.login.project}",
                    "CLOUDSDK_AUTH_ACCESS_TOKEN": "${gcp.login.accessToken}",
                },
            },
        }
    )

    env_content = env_json.apply(lambda json_str: pulumi.StringAsset(json_str))

    pulumi_env = Environment(
        pulumi_esc_env,
        organization=audience,
        name=pulumi_esc_env,
        yaml=env_content,
        opts=pulumi.ResourceOptions(
            depends_on=service_account, ignore_changes=["yaml"]
        ),
    )

Output of pulumi about

 pulumi about
CLI
Version      3.134.1
Go Version   go1.23.1
Go Compiler  gc

Plugins
KIND      NAME           VERSION
resource  aws            6.53.0
resource  cloudflare     5.39.1
resource  command        1.0.1
resource  gcp            8.3.1
resource  kubernetes     4.18.1
resource  pulumiservice  0.26.1
language  python         unknown
resource  tls            5.0.7

Host
OS       darwin
Version  15.0
Arch     arm64

This project is written in python: executable='/Users/marcelobarbosa/Documents/work/iac/venv/bin/python' version='3.12.4'

Current Stack: nayaone/iac/gcp-non-prod-green

TYPE                                                               URN
pulumi:pulumi:Stack                                                urn:pulumi:gcp-non-prod-green::iac::pulumi:pulumi:Stack::iac-gcp-non-prod-green
pulumi:providers:gcp                                               urn:pulumi:gcp-non-prod-green::iac::pulumi:providers:gcp::default_8_3_1
gcp:iam/workloadIdentityPool:WorkloadIdentityPool                  urn:pulumi:gcp-non-prod-green::iac::gcp:iam/workloadIdentityPool:WorkloadIdentityPool::pulumi-pool-green
gcp:iam/workloadIdentityPoolProvider:WorkloadIdentityPoolProvider  urn:pulumi:gcp-non-prod-green::iac::gcp:iam/workloadIdentityPoolProvider:WorkloadIdentityPoolProvider::pulumi-provider-green
gcp:serviceaccount/account:Account                                 urn:pulumi:gcp-non-prod-green::iac::gcp:serviceaccount/account:Account::pulumi-sa-green
pulumi:providers:pulumiservice                                     urn:pulumi:gcp-non-prod-green::iac::pulumi:providers:pulumiservice::default_0_26_1
pulumiservice:index:Environment                                    urn:pulumi:gcp-non-prod-green::iac::pulumiservice:index:Environment::gcp-non-prod
gcp:serviceaccount/iAMBinding:IAMBinding                           urn:pulumi:gcp-non-prod-green::iac::gcp:serviceaccount/iAMBinding:IAMBinding::iam-policy-binding-green
gcp:projects/iAMMember:IAMMember                                   urn:pulumi:gcp-non-prod-green::iac::gcp:projects/iAMMember:IAMMember::iam-binding-green

Found no pending operations associated with gcp-non-prod-green

Backend
Name           pulumi.com
URL            https://app.pulumi.com/marcelo-nayaone
User           marcelo-nayaone
Organizations  marcelo-nayaone, nayaone
Token type     personal

Dependencies:
NAME                  VERSION
pip                   24.2
pulumi_aws            6.53.0
pulumi_cloudflare     5.39.1
pulumi_command        1.0.1
pulumi_gcp            8.3.1
pulumi_kubernetes     4.18.1
pulumi_pulumiservice  0.26.1
pulumi_tls            5.0.7
setuptools            75.1.0
wheel                 0.44.0

Pulumi locates its logs in /var/folders/6z/g3148tgd1xq8g74zk3f2t7vc0000gn/T/ by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).