Compare commits
No commits in common. 'e96b52b85fa9743519d76d9b8814af33d4269a4f' and 'af7dab9c4010f3c0e83c682c905865d3aeeb5016' have entirely different histories.
e96b52b85f
...
af7dab9c40
11 changed files with 0 additions and 108 deletions
@ -1,6 +0,0 @@
|
||||
provider "aws" { |
||||
profile = "superuser" |
||||
region = "ap-southeast-2" |
||||
} |
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
resource "tls_private_key" "mlkey" { |
||||
algorithm = "RSA" |
||||
rsa_bits = 4096 |
||||
} |
||||
|
||||
resource "aws_key_pair" "mlkey" { |
||||
key_name = "mlboxkey" |
||||
public_key = tls_private_key.mlkey.public_key_openssh |
||||
|
||||
provisioner "local-exec" { |
||||
command = "echo '${tls_private_key.mlkey.private_key_pem}' > ./${var.output_ssh_key} & chmod 400 ${var.output_ssh_key}" |
||||
} |
||||
} |
||||
|
||||
data "aws_ami" "aws_linux_ami" { |
||||
most_recent = true |
||||
owners = ["amazon"] |
||||
filter { |
||||
name = "name" |
||||
values = ["debian-12-amd64-*"] |
||||
} |
||||
} |
||||
|
||||
resource "aws_instance" "ml-box" { |
||||
|
||||
ami = data.aws_ami.aws_linux_ami.id |
||||
instance_type = var.instance_type |
||||
key_name = aws_key_pair.mlkey.key_name |
||||
|
||||
vpc_security_group_ids = [ aws_security_group.allow_tls.id ] |
||||
|
||||
tags = { |
||||
Name = "terragenerated-simple-ec2" |
||||
} |
||||
} |
||||
|
||||
# resource "ansible_host" "ml-box" { |
||||
# name = aws_instance.ml-box.public-ip |
||||
# groups = [ ] |
||||
# } |
@ -1,43 +0,0 @@
|
||||
|
||||
resource "aws_security_group" "allow_tls" { |
||||
name = "allow_tls" |
||||
description = "Allow TLS inbound traffic plys ssh" |
||||
|
||||
ingress { |
||||
description = "TLS from VPC" |
||||
from_port = 80 |
||||
to_port = 80 |
||||
protocol = "tcp" |
||||
cidr_blocks = ["0.0.0.0/0"] |
||||
ipv6_cidr_blocks = ["::/0"] |
||||
} |
||||
|
||||
ingress { |
||||
description = "TLS from VPC" |
||||
from_port = 8000 |
||||
to_port = 8999 |
||||
protocol = "tcp" |
||||
cidr_blocks = ["0.0.0.0/0"] |
||||
ipv6_cidr_blocks = ["::/0"] |
||||
} |
||||
|
||||
ingress { |
||||
from_port = 22 |
||||
to_port = 22 |
||||
protocol = "tcp" |
||||
cidr_blocks = ["0.0.0.0/0"] |
||||
ipv6_cidr_blocks = ["::/0"] |
||||
} |
||||
|
||||
egress { |
||||
from_port = 0 |
||||
to_port = 0 |
||||
protocol = "-1" |
||||
cidr_blocks = ["0.0.0.0/0"] |
||||
ipv6_cidr_blocks = ["::/0"] |
||||
} |
||||
|
||||
tags = { |
||||
Name = "allow_tls" |
||||
} |
||||
} |
@ -1,9 +0,0 @@
|
||||
|
||||
output "ml-instance-url" { |
||||
value = aws_instance.ml-box.public_dns |
||||
} |
||||
|
||||
output "key" { |
||||
value = tls_private_key.mlkey.public_key_openssh |
||||
sensitive = true |
||||
} |
@ -1,7 +0,0 @@
|
||||
variable "instance_type" { |
||||
default = "t2.micro" |
||||
} |
||||
|
||||
variable "output_ssh_key" { |
||||
default = "my_ssh.pem" |
||||
} |
Loading…
Reference in new issue