https://pulumi.com logo
Title
f

few-plastic-88435

10/17/2022, 12:38 PM
Hi, Im using Pulumi with YAML. How can I make a condition to check if a resource exists to avoid that Pulumi shows me an error telling me that the resource already exists in the AWS Cloud ?. Regards,
e

echoing-dinner-19531

10/17/2022, 2:13 PM
So there's three cases here: 1. That resource already exists and you want to import it into pulumi for pulumi to now manage, in which case use
pulumi import
2. That resource already exists, and you want to use it but don't want pulumi to manage it, in which case you want to do a "resource read". In other languages that's exposed via a
get
function, I'd have to go look up what the yaml syntax for it is 3. That resource might exist, and you want pulumi to either use it or create a new one. We don't currently have a good way to support this but see https://github.com/pulumi/pulumi/issues/3364#issuecomment-1267034580 for some of our recent thoughts on being able to support this.
f

few-plastic-88435

10/17/2022, 2:23 PM
Hi @echoing-dinner-19531 What I want is how to know this: Yes, A resource already exists and I want to allow Pulumi to detect if this exists that skip it, if not exists, then creates that resource.
e

echoing-dinner-19531

10/17/2022, 2:24 PM
Right so see that issue I linked, we don't currently support that but we're thinking we should be able to add a new resource option to do so
f

few-plastic-88435

10/17/2022, 2:26 PM
One more thing Sir, do you have how can I obtain the Pulumi stack name using YAML ?
e

echoing-dinner-19531

10/17/2022, 3:18 PM
"${pulumi.stack}"
f

few-plastic-88435

10/17/2022, 3:19 PM
Thanks dude. Awesome.