echoing-dinner-19531
05/06/2023, 10:16 AMIs there any way to propagate tags to all resources using YAML?Currently no. There's no support for stack transforms, we've been thinking about maybe enabling that via an external policy but might also be worth supporting some simple transforms in yaml directly so feel free to raise a request.
How can I use Stack Reference with YAMLYes, the code you posted to the thread looks right to me but it does look like the docs pages is missing a section. Raised an issue for that https://github.com/pulumi/pulumi-hugo/issues/2798
Can I use logic and loops in YAML?No the design is intended to be for very simple uses cases, our thinking is if you need logic and loops you shouldn't be using YAML. There is an issue for this https://github.com/pulumi/pulumi-yaml/issues/191 but the current stand is either upgrade to a full language (which is what
pulumi convert
helps with) or use a templating system like CUE or Jinja.
Figuring out arrays in YAML was a huge pain in the ass.Structured config like arrays and objects is still being improved. As you've pointed out the errors aren't great because it's pretty much a raw dump of the schema validation, we have an issue tracking that at https://github.com/pulumi/pulumi/issues/11129.
My major blocker now is the array from configuration. Why is this so terrible?I think (and I haven't touched the yaml codebase for a bit) because yaml never had support for arrays or objects as config. The engine can handle them but YAML doesn't. I'm working on a new set of tests to cover all the language to makes sure they're consistent about their support for config values. Fixing this should fall out from that work.
This seems to successfully get the vpc, but how do make it a local resource?Not totally sure what your asking here given the code snippet? Do you mean how do you define a vpc resource for pulumi to create instead of get?
millions-furniture-75402
05/08/2023, 11:01 AMvariables:
vpcId: ${shared-infrastructure.outputs["vpcId"]}
resources:
shared-infrastructure:
type: pulumi:pulumi:StackReference
properties:
name: ${sharedInfrastructureStackName}
shared-vpc:
type: aws:ec2/vpc:Vpc
get:
# This fails as a stack reference, but succeeds if I hardcode the VPC ID here
id: ${vpcId}
echoing-dinner-19531
05/08/2023, 11:53 AMpulumi convert --language typescript
and see what TS code it gives you and see if that program works as expected. If it does then it's probably a bug in the yaml runtime.millions-furniture-75402
05/08/2023, 1:30 PMconst sharedInfrastructure = new pulumi.StackReference("shared-infrastructure", {name: sharedInfrastructureStackName});
const vpcId = sharedInfrastructure.outputs.vpcId;
const sharedVpc = new aws.ec2.Vpc("shared-vpc", {});
echoing-dinner-19531
05/08/2023, 1:31 PMmillions-furniture-75402
05/08/2023, 1:31 PM--out
flag, it overwrote my Pulumi.yaml
echoing-dinner-19531
05/08/2023, 1:35 PMpulumi new
and require --out to be empty. Worth raising another issue at https://github.com/pulumi/pulumi/issues to point out this UX is not ideal as is though, we can take some ideas of what would be the most preferable behaviour.millions-furniture-75402
05/08/2023, 1:36 PM