plain-businessperson-30883
06/19/2019, 3:19 PMwhite-balloon-205
06/19/2019, 3:20 PMplain-businessperson-30883
06/19/2019, 3:22 PMaws.iam.getPolicyDocument
expect and Output<string>
and resolve it later then?
This is where I’m having the issue:
const iamExecutionPolicy = new aws.iam.Policy('foo', {
policy: pulumi.output(
aws.iam.getPolicyDocument({
statements: [
{
effect: 'Allow',
actions: ['ssm:GetParameters', 'kms:Decrypt'],
resources: [
key.arn.apply(a => a),
],
},
],
}),
).json,
});
key.arn.apply(a => a)
with a string, it works fine.white-balloon-205
06/19/2019, 3:27 PMpolicy: key.arn.apply(a => aws.iam.getPolicyDocument(...))
.plain-businessperson-30883
06/19/2019, 3:41 PMpolicy: anotherKey.arn.apply(anotherArn =>
key.arn.apply(keyArn =>
aws.iam.getPolicyDocument({
Is it correct or is there a better approach to this?white-balloon-205
06/19/2019, 4:46 PMgetPolicyDocument
here? That function is nearly never needed in Pulumi, since its goal is just to create a JSON document, and Pulumi/TypeScript can just do that directly.
Here's a more direct way to accomplish this:
const key = new aws.kms.Key("key");
const iamExecutionPolicy = new aws.iam.Policy('foo', {
policy: pulumi.output({
Version: '2008-10-17',
Statement: [
{
Effect: 'Allow',
Action: ['ssm:GetParameters', 'kms:Decrypt'],
Resource: [ key.arn ],
},
],
}),
});
getPolicyDocument
made up)plain-businessperson-30883
06/19/2019, 5:32 PMType 'UnwrappedObject<{ Version: string; Statement: { Effect: string; Action: string[]; Resource: string[]; }[]; }>' is not assignable to type 'string'.
any
here made the trick: policy: pulumi.output<any>({
🙂