cuddly-barista-79466
05/21/2019, 5:28 PMimport * as pulumi from '@pulumi/pulumi';
import * as aws from '@pulumi/aws';
pulumi.getStack;
const sopsUsers = ['Role1', 'Role2', 'Admins'];
const getsopsUsersArns = sopsUsers.map(r => {
const role: pulumi.Output<
pulumi.UnwrappedObject<aws.iam.GetRoleResult>
> = pulumi.output(
aws.iam.getRole({
name: r
})
);
return role;
});
export const sopsUsersArns = getsopsUsersArns.map(i => i.apply(a => a.arn));
const keyPolicyDocument = pulumi.output(
aws.iam.getPolicyDocument({
statements: [
{
sid: 'Allow attachment of persistent resources',
effect: 'Allow',
principals: [
{
type: 'AWS',
identifiers: getsopsUsersArns.map(i => i.apply(a => a.arn))
}
],
actions: ['kms:CreateGrant', 'kms:ListGrants', 'kms:RevokeGrant'],
resources: ['*'],
conditions: [
{
test: 'Bool',
variable: 'kms:GrantIsForAWSResource',
values: ['true']
}
]
}
]
})
);
const key = new aws.kms.Key('sopsKey',
{
policy: keyPolicyDocument.json
}
);
const alias = new aws.kms.Alias('alias/sopsKey',
{
targetKeyId: key.keyId
}
);
export const kmsKeyName = alias.name;
identifiers
(property) identifiers: string[]
Type 'Output<string>[]' is not assignable to type 'string[]'.
Type 'Output<string>' is not assignable to type 'string'.ts(2322)
getPolicyDocument.d.ts(248, 13): The expected type comes from property 'identifiers' which is declared here on type '{ identifiers: string[]; type: string; }'
big-nail-28315
09/06/2019, 3:49 PM