If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
Example prompt: "A typescript pulumi policy to stop security groups having ssh open to the internet"
Would generate something like:
import * as aws from "@pulumi/aws";
import { PolicyPack, validateResourceOfType } from "@pulumi/policy";
new PolicyPack("lambda", {
policies: [
{
name: "security-group-policy",
description: "Stop security group being open on port 22 to the internet",
enforcementLevel: "mandatory",
validateResource: validateResourceOfType(aws.ec2.SecurityGroup, (securitygroup, args, reportViolation) => {
if(securitygroup.ingress !== undefined && securitygroup.ingress?.length > 0) {
if(securitygroup.ingress.find(x => x.fromPort == 22) &&
securitygroup.ingress.find(x => x.toPort == 22) &&
securitygroup.ingress.find(x => x.cidrBlocks?.indexOf("0.0.0.0/0") !== -1)
) {
reportViolation("Security groups must not have port 22 open to the internet")
}
}
})
}
],
});
No idea where you'd get the data to train this on, but I had a conversation about this today and it sounded like a good idea.
Hello!
Issue details
Example prompt: "A typescript pulumi policy to stop security groups having ssh open to the internet"
Would generate something like:
No idea where you'd get the data to train this on, but I had a conversation about this today and it sounded like a good idea.
Affected area/feature