Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output behaviour from YAML programs are drastically different from other languages #705

Closed
Makeshift opened this issue Dec 21, 2024 · 2 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@Makeshift
Copy link

Makeshift commented Dec 21, 2024

What happened?

I'm attempting to use Pulumi YAML as a drop-in replacement for some simple TypeScript Pulumi projects.

When replicating the resources from a TS project to a YAML project, I noticed that the outputs were drastically different, and YAML seems to have a lot of trouble with outputting objects.

Example

Given the following two programs, I would expect identical output (or at least very similar) from both preview and when deployed:

Pulumi YAML

name: servicename-example
runtime: yaml

resources:
  testbucket:
    type: aws:s3:BucketV2
    properties:
      bucket: connor-other-test

outputs:
  wholebucket: ${testbucket}
  nestedbucket:
    arn: ${testbucket.arn}
    name: ${testbucket.id}

Preview

Outputs:
    nestedbucket: output<string>
    wholebucket : {
        URN: "urn:pulumi:dev::servicename-example::aws:s3/bucketV2:BucketV2::testbucket"
        ID : output<string>
        PackageVersion: ""
    }

Note that nestedbucket is erroneously assumed to be a string, and wholebucket is missing literally all of its properties.

Post-deploy

Outputs:
    nestedbucket: {
        arn : "arn:aws:s3:::connor-other-test"
        name: "connor-other-test"
    }
    wholebucket : {
        URN: "urn:pulumi:dev::servicename-example::aws:s3/bucketV2:BucketV2::testbucket"
        ID : "connor-other-test"
        PackageVersion: ""
    }

Note that nestedbucket has now resolved to an object as it should be, but wholebucket still has no properties.

Pulumi in TypeScript

import * as aws from '@pulumi/aws'

const bucket = new aws.s3.BucketV2('testbucket', {
  bucket: 'connor-other-test'
})

export const wholebucket = bucket
export const nestedbucket = {
  arn: bucket.arn,
  name: bucket.bucket
}

Preview

Outputs:
    nestedbucket: {
        arn : output<string>
        name: "connor-other-test"
    }
    wholebucket : {
        @isPulumiResource                 : true
        accelerationStatus                : output<string>
        acl                               : output<string>
        arn                               : output<string>
        bucket                            : "connor-other-test"
        bucketDomainName                  : output<string>
        bucketPrefix                      : output<string>
        bucketRegionalDomainName          : output<string>
        corsRules                         : output<string>
        forceDestroy                      : false
        grants                            : output<string>
        hostedZoneId                      : output<string>
        id                                : output<string>
        lifecycleRules                    : output<string>
        loggings                          : output<string>
        objectLockConfiguration           : output<string>
        objectLockEnabled                 : output<string>
        policy                            : output<string>
        region                            : output<string>
        replicationConfigurations         : output<string>
        requestPayer                      : output<string>
        serverSideEncryptionConfigurations: output<string>
        tags                              : output<string>
        tagsAll                           : output<string>
        urn                               : "urn:pulumi:dev::servicename-example-ts::aws:s3/bucketV2:BucketV2::testbucket"
        versionings                       : output<string>
        websiteDomain                     : output<string>
        websiteEndpoint                   : output<string>
        websites                          : output<string>
    }

Note that nestedbucket is correctly partially resolved as an object, and wholebucket has all of its properties.

Post-deploy

Outputs:
    nestedbucket: {
        arn : "arn:aws:s3:::connor-other-test"
        name: "connor-other-test"
    }
    wholebucket : {
        accelerationStatus                : ""
        acl                               : <null>
        arn                               : "arn:aws:s3:::connor-other-test"
        bucket                            : "connor-other-test"
        bucketDomainName                  : "connor-other-test.s3.amazonaws.com"
        bucketPrefix                      : ""
        bucketRegionalDomainName          : "connor-other-test.s3.eu-west-1.amazonaws.com"
        corsRules                         : []
        forceDestroy                      : false
        grants                            : [
            [0]: {
                id         : "182bf306d1385fb2588e56ea81ebca5032d400231e1b8a187f57530c128e91b8"
                permissions: [
                    [0]: "FULL_CONTROL"
                ]
                type       : "CanonicalUser"
                uri        : ""
            }
        ]
        hostedZoneId                      : "Z1BKCTXD74EZPE"
        id                                : "connor-other-test"
        lifecycleRules                    : []
        loggings                          : []
        objectLockConfiguration           : <null>
        objectLockEnabled                 : false
        policy                            : ""
        region                            : "eu-west-1"
        replicationConfigurations         : []
        requestPayer                      : "BucketOwner"
        serverSideEncryptionConfigurations: [
            [0]: {
                rules: [
                    [0]: {
                        applyServerSideEncryptionByDefaults: [
                            [0]: {
                                kmsMasterKeyId: ""
                                sseAlgorithm  : "AES256"
                            }
                        ]
                        bucketKeyEnabled                   : false
                    }
                ]
            }
        ]
        urn                               : "urn:pulumi:dev::servicename-example-ts::aws:s3/bucketV2:BucketV2::testbucket"
        versionings                       : [
            [0]: {
                enabled  : false
                mfaDelete: false
            }
        ]
        websiteDomain                     : <null>
        websiteEndpoint                   : <null>
        websites                          : []
    }

Output of pulumi about

Pulumi YAML

CLI
Version      3.143.0
Go Version   go1.23.4
Go Compiler  gc

Plugins
KIND      NAME  VERSION
resource  aws   unknown
language  yaml  unknown

Host
OS       ubuntu
Version  24.04
Arch     x86_64

Dependencies:
NAME  VERSION
aws

(not sure why they're supposedly unknown - according to pulumi plugin ls I have a billion versions of aws and yaml is at 1.10.0, which is bundled into pulumi 3.143.0)

TypeScript

CLI
Version      3.143.0
Go Version   go1.23.4
Go Compiler  gc

Plugins
KIND      NAME    VERSION
language  nodejs  3.143.0

Host
OS       ubuntu
Version  24.04
Arch     x86_64

This project is written in nodejs: executable='/home/connor/.nvm/versions/node/v20.17.0/bin/node' version='v20.17.0'

Additional context

My understanding of the Pulumi ecosystem is that it's meant to allow for consistency across language boundaries, but Pulumi YAML handles outputs very differently from TS. This unfortunately makes Pulumi YAML pretty non-viable for my usecase, because correct previews and outputs for my custom component resources are absolutely critical, and many of them have nested resources that need to be output correctly.

This isn't just a CLI output issue - The outputs are the same on Pulumi Cloud, though I didn't try deploying from/looking at the preview on Cloud.

I also haven't tried with additional languages, as I'm not currently set up to do so.

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

@Makeshift Makeshift added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Dec 21, 2024
@Makeshift
Copy link
Author

Makeshift commented Dec 23, 2024

Re-tested with Pulumi 3.144.1 which comes with version 1.13.0 of the YAML provider, and it still displays the same behaviour. Slightly nicer pulumi about output now, though:

CLI
Version      3.144.1
Go Version   go1.23.4
Go Compiler  gc

Plugins
KIND      NAME  VERSION
resource  aws   unknown
language  yaml  1.13.0

Host
OS       ubuntu
Version  24.04
Arch     x86_64

This project is written in yaml

Current Stack: echobox/servicename-example/dev

TYPE                      URN
pulumi:pulumi:Stack       urn:pulumi:dev::servicename-example::pulumi:pulumi:Stack::servicename-example-dev
pulumi:providers:aws      urn:pulumi:dev::servicename-example::pulumi:providers:aws::default
aws:s3/bucketV2:BucketV2  urn:pulumi:dev::servicename-example::aws:s3/bucketV2:BucketV2::testbucket


Found no pending operations associated with dev

Backend
Name           pulumi.com
URL            https://app.pulumi.com/Makeshift
User           Makeshift
Organizations  Makeshift, echobox
Token type     personal

Dependencies:
NAME  VERSION
aws

@justinvp justinvp added resolution/duplicate This issue is a duplicate of another issue and removed needs-triage Needs attention from the triage team labels Jan 13, 2025
@justinvp
Copy link
Member

This is a duplicate of pulumi/pulumi#3826. The Go SDK (which YAML is built on top of), is serializing resources as "resource references" for stack outputs, which isn't consistent with what is done for Node.js. We should be able to make Go (and therefore YAML) consistent per pulumi/pulumi#3826.

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

No branches or pull requests

2 participants