Open ErdemOzgen opened 10 months ago
Here is a template for AWS-EC2. Creates an instance using Blackcart installed AMI and a security group called "blackcart.app_sg".
terraform { required_providers { aws = { source = "hashicorp/aws" version = "5.26.0" } } }
provider "aws" { region = "REGION" }
data "aws_ami" "packer_ami" { most_recent = true
filter { name = "name" values = ["blackcart-ami-*"] }
owners = ["self"] }
resource "aws_security_group" "blackcart.app_sg" { name = "blackcart.app_sg" description = "All Traffic Allowed"
ingress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } }
resource "aws_instance" "pentest_blackcart_app" { instance_type = "t2.micro" ami = data.aws_ami.packer_ami.id vpc_security_group_ids = [aws_security_group.blackcart.app_sg.id]
user_data = <<-EOF
sudo systemctl start docker EOF
}
Here is a template for AWS-EC2. Creates an instance using Blackcart installed AMI and a security group called "blackcart.app_sg".
terraform { required_providers { aws = { source = "hashicorp/aws" version = "5.26.0" } } }
provider "aws" { region = "REGION" }
Creates EC2 from the blackcart-ami-*. Uses the most recent one.
data "aws_ami" "packer_ami" { most_recent = true
filter { name = "name" values = ["blackcart-ami-*"] }
owners = ["self"] }
Security Group Configurations
resource "aws_security_group" "blackcart.app_sg" { name = "blackcart.app_sg" description = "All Traffic Allowed"
ingress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } }
resource "aws_instance" "pentest_blackcart_app" { instance_type = "t2.micro" ami = data.aws_ami.packer_ami.id vpc_security_group_ids = [aws_security_group.blackcart.app_sg.id]
user_data = <<-EOF
!/bin/bash
}