Hi all Any solution for `Argument of type 'Output&...
# general
b
Hi all Any solution for
Argument of type 'Output<string>' is not assignable to parameter of type 'string'
e
You probably need an "apply", nice blog post about here https://leebriggs.co.uk/blog/2021/05/09/pulumi-apply or the official docs about outputs at https://www.pulumi.com/docs/concepts/inputs-outputs/
b
Thanks @echoing-dinner-19531 for response but i tried with apply which does not work, Here is the code
Copy code
const iapProtectedEmailId = iamStack.getOutput("iapProtectedAdditionalEmail")
const emailIDD = iapProtectedEmailId.apply(x => `${iapProtectedEmailId}`);
additionalIapMembers.push(emailIDD) ;
additionalIapMembers is an string array and it does not allow emailIDD
image.png
Error is
Argument of type 'Output<string>' is not assignable to parameter of type 'string'
e
Copy code
const emailIDD = iapProtectedEmailId.apply(x => `${iapProtectedEmailId}`);
That looks wrong. "apply" must always return an output, you can't use an apply call to remove the outputness of a value. If iamStack is a stack reference you can probably use getOutputDetails instead here to make it easier to work with.
r
Also using Stack References. I just created await-able wrappers for them. e.g.
Copy code
export const vpc = async (): Promise<aws.ec2.Vpc> =>
  new Promise(resolve => account.getOutput('vpc').apply(v => resolve(v)))
Then used like:
Copy code
{
   vpcId: (await vpc()).id,
}
660 Views