05/21/2019, 5:28 PM
Question here trying to use a get function to retrieve AWS ARN by name for an array of names to then be used in creating a policy document, but i am getting hung up on the pulumi output string type to string along with the callbacks not seemingly working effectively in the policydocument. Snippet of code that I am using here
Copy code
import * as pulumi from '@pulumi/pulumi';
import * as aws from '@pulumi/aws';

const sopsUsers = ['Role1', 'Role2', 'Admins'];

const getsopsUsersArns = => {
  const role: pulumi.Output<
  > = pulumi.output(
      name: r
  return role;

export const sopsUsersArns = => i.apply(a => a.arn));
const keyPolicyDocument = pulumi.output(
    statements: [
        sid: 'Allow attachment of persistent resources',
        effect: 'Allow',
        principals: [
            type: 'AWS',
            identifiers: => 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 =;
type error on
Copy code
(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; }'
@channel has anyone else had these issues with the get functions and adapting it to an array or objects?


09/06/2019, 3:49 PM
@cuddly-barista-79466 did you get anywhere with this? I’m having the same problem
I posted in #general