mysterious-sugar-58229
07/23/2024, 12:39 AMimport * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const policy = new aws.iam.Policy("policy", {
name: "test_policy",
path: "/",
description: "My test policy",
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Action: ["ec2:Describe*"],
Effect: "Allow",
Resource: "*",
}],
}),
});
I'm also interested on how you guys are approach authoring them too, so if you have any unique practices, I'm interested to see!modern-zebra-45309
07/23/2024, 8:10 AMmysterious-sugar-58229
07/23/2024, 8:39 AMmysterious-sugar-58229
07/23/2024, 8:45 AMmodern-zebra-45309
07/23/2024, 8:47 AMget_policy_document
doesn't really save much typing or screen space. I do read and write AWS IAM policies outside of Pulumi as well, so having everything in a complete, familiar format is nice. Plus copy-&-pasting between the AWS console, policy documents, and Pulumi code is easiest this way.modern-zebra-45309
07/23/2024, 8:48 AMmysterious-sugar-58229
07/23/2024, 8:52 AMconst S3_READ_ACTIONS = ['s3:GetObject', 's3:ListBucket'] as const;
const S3_WRITE_ACTIONS = ['s3:PutObject', 's3:DeleteObject'] as const;
mysterious-sugar-58229
07/23/2024, 8:52 AMmysterious-sugar-58229
07/23/2024, 8:54 AMmysterious-sugar-58229
07/23/2024, 8:55 AMmodern-zebra-45309
07/23/2024, 8:57 AMmysterious-sugar-58229
07/23/2024, 9:04 AMmysterious-sugar-58229
07/23/2024, 9:08 AMmysterious-sugar-58229
07/23/2024, 9:13 AMmysterious-sugar-58229
07/23/2024, 9:18 AMmysterious-sugar-58229
07/23/2024, 9:19 AMmodern-zebra-45309
07/23/2024, 2:52 PMmodern-zebra-45309
07/23/2024, 2:54 PMbucket.grant_read(role)
is very neat.mysterious-sugar-58229
07/24/2024, 1:58 PMthis.grants(that)
is quite powerful. Lmao, ahh CDK makes me very jealous at times, but then I think about the Cloudformation underneath... lol. Seems like you just gave me an interesting case for a first pull request!