06/06/2023, 5:53 AM
Hi, I am struggling a bit with the task to query the AWS region and account my code is operating in.
Copy code
const account = aws.getCallerIdentity({}).then((a) => a.accountId);
const region = aws.getRegion({}).then((r) =>
These values end up in an IAM policy to access parameters in the SystemManager’s Parameter Store:
Copy code
  Action: ["ssm:GetParameter"],
  Effect: "Allow",
  Resource: [ `arn:aws:ssm:${region}:${account}:parameter/foo/bar/*` ],
But when I try to apply the code it will end in an error
Copy code
error: 1 error occurred:
        * updating urn:pulumi:dev::foo::aws:iam/rolePolicy:RolePolicy::lambdaRoleSapDataProcessorPolicy: 1 error occurred:
        * putting IAM role policy lambdaRoleFooDataProcessorPolicy-681121b: MalformedPolicyDocument: The policy failed legacy parsing
To me, this looks like I am making a mistake in resolving the two promises? I am not very fluent with TypeScript