Skip to content

Commit

Permalink
Create main config file
Browse files Browse the repository at this point in the history
  • Loading branch information
iganbold committed Sep 27, 2020
1 parent 288f041 commit fa3deff
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
provider "aws" {
region = "us-east-1"
profile = "terraform"
}

resource "tls_private_key" "this" {
algorithm = "RSA"
}

resource "aws_key_pair" "this" {
key_name = "kali"
public_key = tls_private_key.this.public_key_openssh
}

data "template_file" "user_data" {
template = file("./payload.sh")
}

resource "aws_default_subnet" "default" {
availability_zone = var.availability_zone
}

resource "aws_instance" "this" {
ami = "ami-08c8387e171a3d095"
instance_type = var.instance_type
availability_zone = var.availability_zone
associate_public_ip_address = true
key_name = aws_key_pair.this.key_name
user_data = data.template_file.user_data.rendered
subnet_id = var.subnet_id == null ? aws_default_subnet.default.id : var.subnet_id

root_block_device {
volume_size = var.volume_size
}
}

0 comments on commit fa3deff

Please # to comment.