sparse-intern-71089
10/12/2022, 5:15 AMlittle-cartoon-10569
10/12/2022, 5:46 AMthis.cloudwatchLog
is an output, so this.cloudwatchLog.arn
is a lifted output.little-cartoon-10569
10/12/2022, 5:47 AMlittle-cartoon-10569
10/12/2022, 5:47 AMlittle-cartoon-10569
10/12/2022, 5:48 AMgreen-bird-4706
10/12/2022, 6:24 AMPolicyDocument
looks to be the answer. I'm just trying to port what I had in Terraform to Pulumi and learning along the way. Thanks for the help.green-bird-4706
10/12/2022, 8:59 PMthis.cloudwatchPolicy = new aws.iam.Policy(`${name}-can-log-to-cloudwatch`, {
description: `Grants ${name} permission to write to Cloudwatch logs for monitoring`,
policy: {
"Version": "2012-10-17",
"Statement": [
{
"Sid": `${snakeCaseName}CanLog`,
"Effect": "Allow",
"Action": [
"logs:PutLogEvents",
"logs:CreateLogStream",
"logs:CreateLogGroup"
],
"Resource": this.cloudwatchLog.arn.apply((arn: string) => arn)
}
]
},
}, { parent: this });
For anyone else with this issue - this worked for me. And I think this is how it's done??little-cartoon-10569
10/12/2022, 9:01 PMlittle-cartoon-10569
10/12/2022, 9:02 PMthis.cloudwatchLog.arn.apply((arn: string) => arn)
. Just use this.cloudwatchLog.arn
green-bird-4706
10/12/2022, 9:03 PMAnd this is redundant:I did try that and it failed. Error message said I should try this and it worked. Let me try it again.. Just usethis.cloudwatchLog.arn.apply((arn: string) => arn)
this.cloudwatchLog.arn
green-bird-4706
10/12/2022, 9:12 PMthis.cloudwatchPolicy = new aws.iam.Policy(`${name}-can-log-to-cloudwatch`, {
description: `Grants ${name} permission to write to Cloudwatch logs for monitoring`,
policy: {
Version: "2012-10-17",
Statement: [
{
Sid: `${snakeCaseName}CanLog`,
Effect: "Allow",
Action: [
"logs:PutLogEvents",
"logs:CreateLogStream",
"logs:CreateLogGroup"
],
Resource: this.cloudwatchLog.arn //.apply((value: string) => value)
}
]
},
}, { parent: this.vpcRole });
And it works. I think my state got a little bit funky and might have caused the error last night. Thank you. 🙏green-bird-4706
10/13/2022, 6:00 AMpulumi.interpolate`${myS3Bucket.arn}/*`
Which is good for making policies. Just if anyone else reads this before Slack deletes it.