Closed Zaid-Ajaj closed 5 months ago
Outputs just keep using their logical name because their lexical name cannot be referenced anywhere
Why do we even support __logicalName on outputs in PCL? I don't think any language supports referencing of outputs, this looks like something we should clean up.
Why do we even support __logicalName on outputs in PCL?
My first thought was maybe block labels couldn't be arbitary strings, and that's true for the first label but that's always going to be "output". The second block label is fine to be a string literal: https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#structural-elements
We should sanitize this.
Why do we even support __logicalName on outputs in PCL? I don't think any language supports referencing of outputs, this looks like something we should clean up.
Indeed 💯
@Frassle outputs have logical names because they can have names that are not legal identifiers using the export
facility.
https://github.com/pulumi/pulumi/pull/9464#issuecomment-1109026906
Yeh we worked that out, but outputs only have one name. Unlike resources which have a source name and a logical name outputs just have a logical name. See https://github.com/pulumi/pulumi/pull/15180 for the follow up on this.
Description
Fixes #539, #477
This PR adds support for resources and config variables to have a logical name other than their lexical name which is used to reference the resources or variables in the YAML program.
Added as a top-level field:
Where the
bucket
is the lexical name that is used for the program evaluator andmy-bucket
is the name that is used when registering the resource. In TypeScript it would look like this:Similarly, configuration variables can now have a logical name as well where at runtime, it will be the key used to query the config data provided by Pulumi CLI whereas their lexical name is just how they are defined and referenced in the program.
Program-gen for YAML has been updated. Take this PCL:
Becomes: