Should I always use "pulumi.concat()" when using s...
# general
r
Should I always use "pulumi.concat()" when using string resources gotten from the cloud? For example, if I get a bucket name from SSM and want to create a bucket with that name:
Copy code
const aws = require("@pulumi/aws");

const pictures_bucket_name: String = aws.ssm.getParameter("pictures_bucket")

const pictures_bucket = new aws.s3.Bucket(pictures_bucket_name+"_resource", {
    bucket: pictures_bucket_name
})
So, in the 'name' parameter of the bucket should I use 'pulumi.concat(pictures_bucket_name, "_resource")' or just that native string concatenation is ok? Update: I think I got it, but if someone could provide a validation to way I'm saying I would appreciate: Output objects HAS to be used when I retrieve resources from the cloud and they might be automatically created by some method that returns Output objects of a given resource or I might have to wrap values by hand in an Output object (using
pulumi.output()
), but there are two main moments in which I will use these values wrapped by an Output object: "deploy-time" and runtime. If I want to manipulate the value wrapped by the Output object during deploy-time, when things may not be yet defined and values may not exist yet, then I must use a Promise-like approach with
Output<T>.apply(f: T -> G)
and all resource-method parameters will accept this transformed Output as a valid argument. Or, in some cases (like native Pulumi classes) I may skip the
apply()
step and just retrieve the expected value with
Output<T>.some_attribute
. If I want to use the value wrapped by the Output object during runtime, then I must call the
Output<T>.get()
method to retrieve the actual
Object<T>
. Sorry if the question is not well formulated or seems like lack of effort in finding documentation, I've read a lot of it but I'm missing use cases and examples.
👍 2