https://pulumi.com logo
#general
Title
# general
f

freezing-sugar-24066

12/06/2021, 11:45 PM
If I am using
acm.getCertificate()z
for the only purpose of using the
arn
to create a CloudFront distribution with an
cloudfront.DistributionViewerCertificate
object, but would like the class creating the cloudfront distribution to accept either just a static string
arn: string
or an
arn: Output<string>
, what’s the cleanest way to go about that? (I believe one can pass in strings to Output<string> but am only 92% sure). I think I’ve got it right that I can do this so that Pulumi understands the dependency graph:
Copy code
const gcResult = await acm.getCertificateOutput({ domain })

new aws.cloudfront.Distribution('api-cloudfront', {
  ...
  viewerCertificate: gdResult.apply(r => ({
    acmCertificateArn: r.arn
  })),
  ...
})
But how do I wrap the
new()
in a class that accepts
Input<string>
instead of
Input<acm.GetCertificateResult>
, since I don’t need to depend on the whole object and don’t want to write a class that requires passing in an object with all the properties of
acm.GetCertificateResult
?