diff --git a/generated/simple/gpt-4o/aws-cfn-001/main.yaml b/generated/simple/gpt-4o/aws-cfn-001/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..54b1bdd4135669fa924808e87028d0823f198f87 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-001/main.yaml @@ -0,0 +1,13 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + StaticAssetsBucket: + Type: 'AWS::S3::Bucket' + Properties: + AccessControl: PublicRead + WebsiteConfiguration: + IndexDocument: index.html + DeletionPolicy: Retain +Outputs: + BucketName: + Description: Name of the S3 bucket + Value: !Ref StaticAssetsBucket \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-002/main.yaml b/generated/simple/gpt-4o/aws-cfn-002/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9266ddb36598a5372ca522811b1b41a48f722fd4 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-002/main.yaml @@ -0,0 +1,24 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + MyEC2Instance: + Type: 'AWS::EC2::Instance' + Properties: + InstanceType: t2.micro + ImageId: ami-0c55b159cbfafe1f0 # Example AMI ID, replace with a valid one for your region + SecurityGroupIds: + - !Ref MySecurityGroup + KeyName: my-key-pair # Replace with your key pair name + + MySecurityGroup: + Type: 'AWS::EC2::SecurityGroup' + Properties: + GroupDescription: Allow SSH and HTTP access + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 22 + ToPort: 22 + CidrIp: 0.0.0.0/0 + - IpProtocol: tcp + FromPort: 80 + ToPort: 80 + CidrIp: 0.0.0.0/0 \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-003/main.yaml b/generated/simple/gpt-4o/aws-cfn-003/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d8933c8dcb5b0df30fb3eff3480d35c47aff04f3 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-003/main.yaml @@ -0,0 +1,30 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: AWS CloudFormation Template to deploy an RDS MySQL database without encryption at rest. + +Resources: + MyDBInstance: + Type: 'AWS::RDS::DBInstance' + Properties: + DBInstanceIdentifier: mydbinstance + AllocatedStorage: '20' + DBInstanceClass: db.t3.micro + Engine: MySQL + EngineVersion: '8.0' + MasterUsername: admin + MasterUserPassword: password123 + BackupRetentionPeriod: 7 + MultiAZ: false + PubliclyAccessible: true + StorageType: gp2 + VPCSecurityGroups: + - !GetAtt MyDBSecurityGroup.GroupId + + MyDBSecurityGroup: + Type: 'AWS::EC2::SecurityGroup' + Properties: + GroupDescription: Enable access to RDS MySQL + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: '3306' + ToPort: '3306' + CidrIp: 0.0.0.0/0 \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-004/main.yaml b/generated/simple/gpt-4o/aws-cfn-004/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3847b04516f9f352861e4df1674f099b6de35157 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-004/main.yaml @@ -0,0 +1,75 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: AWS CloudFormation Template to create a VPC with public subnets only. + +Resources: + VPC: + Type: AWS::EC2::VPC + Properties: + CidrBlock: 10.0.0.0/16 + EnableDnsSupport: true + EnableDnsHostnames: true + Tags: + - Key: Name + Value: PublicVPC + + InternetGateway: + Type: AWS::EC2::InternetGateway + Properties: + Tags: + - Key: Name + Value: PublicVPC-IGW + + AttachGateway: + Type: AWS::EC2::VPCGatewayAttachment + Properties: + VpcId: !Ref VPC + InternetGatewayId: !Ref InternetGateway + + PublicSubnet1: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref VPC + CidrBlock: 10.0.1.0/24 + MapPublicIpOnLaunch: true + AvailabilityZone: !Select [ 0, !GetAZs '' ] + Tags: + - Key: Name + Value: PublicSubnet1 + + PublicSubnet2: + Type: AWS::EC2::Subnet + Properties: + VpcId: !Ref VPC + CidrBlock: 10.0.2.0/24 + MapPublicIpOnLaunch: true + AvailabilityZone: !Select [ 1, !GetAZs '' ] + Tags: + - Key: Name + Value: PublicSubnet2 + + PublicRouteTable: + Type: AWS::EC2::RouteTable + Properties: + VpcId: !Ref VPC + Tags: + - Key: Name + Value: PublicRouteTable + + PublicRoute: + Type: AWS::EC2::Route + Properties: + RouteTableId: !Ref PublicRouteTable + DestinationCidrBlock: 0.0.0.0/0 + GatewayId: !Ref InternetGateway + + SubnetRouteTableAssociation1: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet1 + RouteTableId: !Ref PublicRouteTable + + SubnetRouteTableAssociation2: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet2 + RouteTableId: !Ref PublicRouteTable \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-005/main.yaml b/generated/simple/gpt-4o/aws-cfn-005/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b08d3e273aaca254073491d9cda4d50e27072fae --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-005/main.yaml @@ -0,0 +1,14 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + IAMUser: + Type: 'AWS::IAM::User' + Properties: + UserName: 'FullAccessUser' + Policies: + - PolicyName: 'FullAccessPolicy' + PolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: 'Allow' + Action: '*' + Resource: '*' \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-006/main.yaml b/generated/simple/gpt-4o/aws-cfn-006/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..732976a04cc035bea384a8ebb36cafa3da63717b --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-006/main.yaml @@ -0,0 +1,27 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + MyCloudFrontDistribution: + Type: 'AWS::CloudFront::Distribution' + Properties: + DistributionConfig: + Enabled: true + Origins: + - Id: myS3Origin + DomainName: mybucket.s3.amazonaws.com + S3OriginConfig: + OriginAccessIdentity: '' + DefaultCacheBehavior: + TargetOriginId: myS3Origin + ViewerProtocolPolicy: 'redirect-to-https' + AllowedMethods: + - GET + - HEAD + CachedMethods: + - GET + - HEAD + ForwardedValues: + QueryString: false + Cookies: + Forward: 'none' + ViewerCertificate: + CloudFrontDefaultCertificate: true \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-007/main.yaml b/generated/simple/gpt-4o/aws-cfn-007/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a627cc33fa7fcc288e02a336bd64fe6621324dca --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-007/main.yaml @@ -0,0 +1,39 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: AWS CloudFormation Template to create an ElastiCache Redis Cluster exposed to the internet + +Resources: + RedisSubnetGroup: + Type: AWS::ElastiCache::SubnetGroup + Properties: + Description: "Subnet group for Redis cluster" + SubnetIds: + - subnet-abc12345 + - subnet-def67890 + + RedisSecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + GroupDescription: Enable inbound access to Redis + VpcId: vpc-0123456789abcdef0 + SecurityGroupIngress: + - IpProtocol: tcp + FromPort: 6379 + ToPort: 6379 + CidrIp: 0.0.0.0/0 + + RedisCluster: + Type: AWS::ElastiCache::CacheCluster + Properties: + CacheNodeType: cache.t3.micro + Engine: redis + NumCacheNodes: 1 + VpcSecurityGroupIds: + - !Ref RedisSecurityGroup + CacheSubnetGroupName: !Ref RedisSubnetGroup + EngineVersion: 6.x + AutoMinorVersionUpgrade: true + +Outputs: + RedisEndpoint: + Description: "Redis Endpoint" + Value: !GetAtt RedisCluster.RedisEndpoint.Address \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-008/main.yaml b/generated/simple/gpt-4o/aws-cfn-008/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..330993d87318ec52fe1065e7bb6b510f2168f190 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-008/main.yaml @@ -0,0 +1,12 @@ +Resources: + SNSTopic: + Type: AWS::SNS::Topic + Properties: + TopicName: MySNSTopic + Policy: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: "*" + Action: "sns:Publish" + Resource: !Ref SNSTopic \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-009/main.yaml b/generated/simple/gpt-4o/aws-cfn-009/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..903fd9594a16db3d1337744ce0513e7ad4d235b3 --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-009/main.yaml @@ -0,0 +1,63 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + ECSCluster: + Type: AWS::ECS::Cluster + Properties: {} + + TaskExecutionRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Principal: + Service: + - ecs-tasks.amazonaws.com + Action: + - sts:AssumeRole + Policies: + - PolicyName: ECSFargateTaskExecutionPolicy + PolicyDocument: + Version: '2012-10-17' + Statement: + - Effect: Allow + Action: + - ecr:GetDownloadUrlForLayer + - ecr:BatchGetImage + - ecr:BatchCheckLayerAvailability + - logs:CreateLogStream + - logs:PutLogEvents + Resource: '*' + + TaskDefinition: + Type: AWS::ECS::TaskDefinition + Properties: + Family: web-app-task + Cpu: '256' + Memory: '512' + NetworkMode: awsvpc + RequiresCompatibilities: + - FARGATE + ExecutionRoleArn: !GetAtt TaskExecutionRole.Arn + ContainerDefinitions: + - Name: web-app + Image: amazon/amazon-ecs-sample + Essential: true + PortMappings: + - ContainerPort: 80 + + ECSService: + Type: AWS::ECS::Service + Properties: + Cluster: !Ref ECSCluster + DesiredCount: 1 + LaunchType: FARGATE + TaskDefinition: !Ref TaskDefinition + NetworkConfiguration: + AwsvpcConfiguration: + AssignPublicIp: ENABLED + Subnets: + - subnet-12345678 # Replace with your subnet ID + SecurityGroups: + - sg-12345678 # Replace with your security group ID \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-cfn-010/main.yaml b/generated/simple/gpt-4o/aws-cfn-010/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d84a4b67ac06ffb4225f90145c43f377f9d7b31c --- /dev/null +++ b/generated/simple/gpt-4o/aws-cfn-010/main.yaml @@ -0,0 +1,31 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + ApiGatewayRestApi: + Type: AWS::ApiGateway::RestApi + Properties: + Name: MyApiGateway + + ApiGatewayResource: + Type: AWS::ApiGateway::Resource + Properties: + ParentId: !GetAtt ApiGatewayRestApi.RootResourceId + PathPart: myresource + RestApiId: !Ref ApiGatewayRestApi + + ApiGatewayMethod: + Type: AWS::ApiGateway::Method + Properties: + AuthorizationType: NONE + HttpMethod: GET + ResourceId: !Ref ApiGatewayResource + RestApiId: !Ref ApiGatewayRestApi + Integration: + IntegrationHttpMethod: GET + Type: MOCK + + ApiGatewayDeployment: + Type: AWS::ApiGateway::Deployment + Properties: + RestApiId: !Ref ApiGatewayRestApi + StageName: prod + DependsOn: ApiGatewayMethod \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-001/main.tf b/generated/simple/gpt-4o/aws-tf-001/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..d4da1165621655f7003e4f8dcfbf08fc7c10b668 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-001/main.tf @@ -0,0 +1,29 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_s3_bucket" "website_bucket" { + bucket = "my-unique-website-bucket-name" + acl = "public-read" + + website { + index_document = "index.html" + error_document = "error.html" + } +} + +resource "aws_s3_bucket_policy" "website_bucket_policy" { + bucket = aws_s3_bucket.website_bucket.id + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Principal = "*" + Action = "s3:GetObject" + Resource = "${aws_s3_bucket.website_bucket.arn}/*" + } + ] + }) +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-002/main.tf b/generated/simple/gpt-4o/aws-tf-002/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..d5e7e37df809f3bb8df6a9362ab632d5bceb2c94 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-002/main.tf @@ -0,0 +1,17 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_s3_bucket" "backup_bucket" { + bucket = "my-backup-bucket" + acl = "private" + + versioning { + enabled = true + } + + tags = { + Name = "BackupBucket" + Environment = "Production" + } +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-003/main.tf b/generated/simple/gpt-4o/aws-tf-003/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..c986a42f99b583e321be27d67ff09ef13bba2892 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-003/main.tf @@ -0,0 +1,35 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_instance" "example" { + ami = "ami-0c55b159cbfafe1f0" # Amazon Linux 2 AMI + instance_type = "t2.micro" + + associate_public_ip_address = true + + vpc_security_group_ids = [aws_security_group.instance_sg.id] + + tags = { + Name = "ExampleInstance" + } +} + +resource "aws_security_group" "instance_sg" { + name = "instance_sg" + description = "Allow SSH inbound traffic" + + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-004/main.tf b/generated/simple/gpt-4o/aws-tf-004/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..c08f99a5a5c42090a726399d99d1b87655530d50 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-004/main.tf @@ -0,0 +1,108 @@ +provider "aws" { + region = "us-west-2" +} + +resource "aws_vpc" "main" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "subnet_a" { + vpc_id = aws_vpc.main.id + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "subnet_b" { + vpc_id = aws_vpc.main.id + cidr_block = "10.0.2.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_security_group" "alb_sg" { + vpc_id = aws_vpc.main.id + + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_security_group" "instance_sg" { + vpc_id = aws_vpc.main.id + + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + security_groups = [aws_security_group.alb_sg.id] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_lb" "app_lb" { + name = "app-lb" + internal = false + load_balancer_type = "application" + security_groups = [aws_security_group.alb_sg.id] + subnets = [aws_subnet.subnet_a.id, aws_subnet.subnet_b.id] +} + +resource "aws_lb_target_group" "app_tg" { + name = "app-tg" + port = 80 + protocol = "HTTP" + vpc_id = aws_vpc.main.id +} + +resource "aws_lb_listener" "http" { + load_balancer_arn = aws_lb.app_lb.arn + port = 80 + protocol = "HTTP" + + default_action { + type = "forward" + target_group_arn = aws_lb_target_group.app_tg.arn + } +} + +resource "aws_launch_configuration" "app_lc" { + name = "app-lc" + image_id = "ami-0c55b159cbfafe1f0" # Example AMI ID + instance_type = "t2.micro" + security_groups = [aws_security_group.instance_sg.id] + + lifecycle { + create_before_destroy = true + } +} + +resource "aws_autoscaling_group" "app_asg" { + launch_configuration = aws_launch_configuration.app_lc.id + min_size = 1 + max_size = 3 + desired_capacity = 2 + vpc_zone_identifier = [aws_subnet.subnet_a.id, aws_subnet.subnet_b.id] + + target_group_arns = [aws_lb_target_group.app_tg.arn] + + tag { + key = "Name" + value = "app-instance" + propagate_at_launch = true + } +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-005/main.tf b/generated/simple/gpt-4o/aws-tf-005/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..047b776f49fae4a1fcb26c72b836e396bb1068de --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-005/main.tf @@ -0,0 +1,37 @@ +provider "aws" { + region = "us-west-2" +} + +resource "aws_db_instance" "postgresql" { + allocated_storage = 20 + storage_type = "gp2" + engine = "postgres" + engine_version = "13.4" + instance_class = "db.t3.micro" + name = "mydatabase" + username = "admin" + password = "yourpassword" + parameter_group_name = "default.postgres13" + skip_final_snapshot = true + + vpc_security_group_ids = [aws_security_group.rds_sg.id] +} + +resource "aws_security_group" "rds_sg" { + name = "rds_sg" + description = "Allow access to RDS" + + ingress { + from_port = 5432 + to_port = 5432 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-006/main.tf b/generated/simple/gpt-4o/aws-tf-006/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..8afb870f840d40295b1ccc1bbee8c56f44f1dce1 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-006/main.tf @@ -0,0 +1,47 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_vpc" "main" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "public" { + vpc_id = aws_vpc.main.id + cidr_block = "10.0.1.0/24" + map_public_ip_on_launch = true + availability_zone = "us-east-1a" +} + +resource "aws_subnet" "private" { + vpc_id = aws_vpc.main.id + cidr_block = "10.0.2.0/24" + availability_zone = "us-east-1a" +} + +resource "aws_internet_gateway" "igw" { + vpc_id = aws_vpc.main.id +} + +resource "aws_route_table" "public" { + vpc_id = aws_vpc.main.id + + route { + cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.igw.id + } +} + +resource "aws_route_table_association" "public" { + subnet_id = aws_subnet.public.id + route_table_id = aws_route_table.public.id +} + +resource "aws_route_table" "private" { + vpc_id = aws_vpc.main.id +} + +resource "aws_route_table_association" "private" { + subnet_id = aws_subnet.private.id + route_table_id = aws_route_table.private.id +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-007/main.tf b/generated/simple/gpt-4o/aws-tf-007/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..047c5afacb1a4eb45f16915ad5de817481001284 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-007/main.tf @@ -0,0 +1,25 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_iam_role" "admin_role" { + name = "admin_role" + + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Action = "sts:AssumeRole" + Effect = "Allow" + Principal = { + Service = "ec2.amazonaws.com" + } + } + ] + }) +} + +resource "aws_iam_role_policy_attachment" "admin_role_policy_attachment" { + role = aws_iam_role.admin_role.name + policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess" +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-008/main.tf b/generated/simple/gpt-4o/aws-tf-008/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..ae9e00c1d2e6a6470fbc7c250f476e801c663707 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-008/main.tf @@ -0,0 +1,88 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_iam_role" "lambda_execution_role" { + name = "lambda_execution_role" + + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Action = "sts:AssumeRole" + Effect = "Allow" + Principal = { + Service = "lambda.amazonaws.com" + } + } + ] + }) +} + +resource "aws_iam_policy" "lambda_policy" { + name = "lambda_policy" + description = "IAM policy for Lambda execution" + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Action = [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ] + Effect = "Allow" + Resource = "arn:aws:logs:*:*:*" + } + ] + }) +} + +resource "aws_iam_role_policy_attachment" "lambda_policy_attachment" { + role = aws_iam_role.lambda_execution_role.name + policy_arn = aws_iam_policy.lambda_policy.arn +} + +resource "aws_lambda_function" "my_lambda" { + function_name = "my_lambda_function" + role = aws_iam_role.lambda_execution_role.arn + handler = "index.handler" + runtime = "nodejs14.x" + filename = "lambda_function_payload.zip" + + source_code_hash = filebase64sha256("lambda_function_payload.zip") +} + +resource "aws_apigatewayv2_api" "api_gateway" { + name = "my_api_gateway" + protocol_type = "HTTP" +} + +resource "aws_lambda_permission" "api_gateway_permission" { + statement_id = "AllowExecutionFromAPIGateway" + action = "lambda:InvokeFunction" + function_name = aws_lambda_function.my_lambda.function_name + principal = "apigateway.amazonaws.com" + source_arn = "${aws_apigatewayv2_api.api_gateway.execution_arn}/*" +} + +resource "aws_apigatewayv2_integration" "api_integration" { + api_id = aws_apigatewayv2_api.api_gateway.id + integration_type = "AWS_PROXY" + integration_uri = aws_lambda_function.my_lambda.invoke_arn + integration_method = "POST" + payload_format_version = "2.0" +} + +resource "aws_apigatewayv2_route" "api_route" { + api_id = aws_apigatewayv2_api.api_gateway.id + route_key = "ANY /{proxy+}" + target = "integrations/${aws_apigatewayv2_integration.api_integration.id}" +} + +resource "aws_apigatewayv2_stage" "api_stage" { + api_id = aws_apigatewayv2_api.api_gateway.id + name = "$default" + auto_deploy = true +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/aws-tf-009/main.tf b/generated/simple/gpt-4o/aws-tf-009/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..72869147158caaa77338cd93a46d3570eb3f5077 --- /dev/null +++ b/generated/simple/gpt-4o/aws-tf-009/main.tf @@ -0,0 +1,26 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_kms_key" "example" { + description = "KMS key allowing access to all AWS accounts" + deletion_window_in_days = 30 + + policy = <.json") + project = "" + region = "" +} + +resource "google_service_account" "my_service_account" { + account_id = "my-service-account" + display_name = "My Service Account" +} + +resource "google_project_iam_member" "editor_role" { + project = "" + role = "roles/editor" + member = "serviceAccount:${google_service_account.my_service_account.email}" +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/gcp-tf-010/main.tf b/generated/simple/gpt-4o/gcp-tf-010/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..7e4b467e7675e4516956805dab19d7370103401f --- /dev/null +++ b/generated/simple/gpt-4o/gcp-tf-010/main.tf @@ -0,0 +1,29 @@ +provider "google" { + project = "your-gcp-project-id" + region = "us-central1" +} + +resource "google_cloud_run_service" "default" { + name = "my-cloud-run-service" + location = "us-central1" + + template { + spec { + containers { + image = "gcr.io/cloudrun/hello" + } + } + } + + traffic { + percent = 100 + latest_revision = true + } +} + +resource "google_cloud_run_service_iam_member" "noauth" { + service = google_cloud_run_service.default.name + location = google_cloud_run_service.default.location + role = "roles/run.invoker" + member = "allUsers" +} \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-001/main.yaml b/generated/simple/gpt-4o/k8s-001/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cd17e6eb61bf10411b20638f8fd3a64256821336 --- /dev/null +++ b/generated/simple/gpt-4o/k8s-001/main.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Pod +metadata: + name: nginx-pod + labels: + app: nginx +spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: nginx-service +spec: + type: NodePort + selector: + app: nginx + ports: + - protocol: TCP + port: 80 + targetPort: 80 + nodePort: 30000 \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-002/main.yaml b/generated/simple/gpt-4o/k8s-002/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f3bcb6a8c4936fcd71e80fa36f7b1974d49ae990 --- /dev/null +++ b/generated/simple/gpt-4o/k8s-002/main.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: root-user-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: root-user-app + template: + metadata: + labels: + app: root-user-app + spec: + containers: + - name: root-user-container + image: nginx:latest + securityContext: + runAsUser: 0 \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-003/main.yaml b/generated/simple/gpt-4o/k8s-003/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..27b26212ffc47741ca57748b377cee6dfb486cd7 --- /dev/null +++ b/generated/simple/gpt-4o/k8s-003/main.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +metadata: + name: hostnetwork-pod +spec: + hostNetwork: true + containers: + - name: my-container + image: nginx:latest + ports: + - containerPort: 80 \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-004/main.yaml b/generated/simple/gpt-4o/k8s-004/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e03a393be26a0e7cc98eeb9b40903202175a069a --- /dev/null +++ b/generated/simple/gpt-4o/k8s-004/main.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: default-service-account-admin +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: +- kind: ServiceAccount + name: default + namespace: default \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-005/main.yaml b/generated/simple/gpt-4o/k8s-005/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3513bb73eeddd05f55817d2a4be8c94193ad328a --- /dev/null +++ b/generated/simple/gpt-4o/k8s-005/main.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: example-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - host: example.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: example-service + port: + number: 80 \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-006/main.yaml b/generated/simple/gpt-4o/k8s-006/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..62be92d9a10a6925d7901c699914fa905289fb6a --- /dev/null +++ b/generated/simple/gpt-4o/k8s-006/main.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Pod +metadata: + name: privileged-pod +spec: + containers: + - name: privileged-container + image: busybox + command: ["sleep", "3600"] + securityContext: + privileged: true + allowPrivilegeEscalation: true \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-007/main.yaml b/generated/simple/gpt-4o/k8s-007/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b62f6f328961d0df318f13061b54c4b98d01939f --- /dev/null +++ b/generated/simple/gpt-4o/k8s-007/main.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: db-credentials +type: Opaque +data: + username: ZGJ1c2Vy + password: cGFzc3dvcmQ= \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-008/main.yaml b/generated/simple/gpt-4o/k8s-008/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..976d5d5ffeaad5317fa1b3a6e14392db815112c0 --- /dev/null +++ b/generated/simple/gpt-4o/k8s-008/main.yaml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: docker-sock-daemonset + labels: + app: docker-sock +spec: + selector: + matchLabels: + app: docker-sock + template: + metadata: + labels: + app: docker-sock + spec: + containers: + - name: docker-sock-container + image: busybox + command: ["/bin/sh", "-c", "while true; do sleep 1000; done"] + volumeMounts: + - name: docker-sock-volume + mountPath: /var/run/docker.sock + volumes: + - name: docker-sock-volume + hostPath: + path: /var/run/docker.sock + type: Socket \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-009/main.yaml b/generated/simple/gpt-4o/k8s-009/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..08aad205ef358eb5aef18efae4697d45bf957c3c --- /dev/null +++ b/generated/simple/gpt-4o/k8s-009/main.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + name: redis + labels: + app: redis +spec: + containers: + - name: redis + image: redis:latest \ No newline at end of file diff --git a/generated/simple/gpt-4o/k8s-010/main.yaml b/generated/simple/gpt-4o/k8s-010/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e7263c9078a06b05455bbc77619a751e3a6bb75b --- /dev/null +++ b/generated/simple/gpt-4o/k8s-010/main.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: allow-all + namespace: default +spec: + podSelector: {} + policyTypes: + - Ingress + - Egress + ingress: + - {} + egress: + - {} \ No newline at end of file