Skip to content

Instantly share code, notes, and snippets.

@cnunciato
Last active October 4, 2022 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnunciato/47acb7f701fb89d0d362d56440344a2b to your computer and use it in GitHub Desktop.
Save cnunciato/47acb7f701fb89d0d362d56440344a2b to your computer and use it in GitHub Desktop.
const cleanupHandlerPolicy = new aws.iam.Policy("cleanup-handler-policy", {
policy: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Action: [
"ec2:DescribeInstances",
],
Resource: [
"*",
],
},
{
Effect: "Allow",
Action: [
"ec2:TerminateInstances",
],
Resource: [
args.subnet.arn,
pulumi.interpolate `arn:aws:ec2:${awsRegion}::image/${imageID}`,
pulumi.interpolate `arn:aws:ec2:${awsRegion}:${awsAccountID}:network-interface/*`,
pulumi.interpolate `arn:aws:ec2:${awsRegion}:${awsAccountID}:instance/*`,
pulumi.interpolate `arn:aws:ec2:${awsRegion}:${awsAccountID}:volume/*`,
pulumi.interpolate `arn:aws:ec2:${awsRegion}:${awsAccountID}:key-pair/*`,
pulumi.interpolate `arn:aws:ec2:${awsRegion}:${awsAccountID}:security-group/*`,
],
},
],
},
tags,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment