Compare commits
No commits in common. "4d5bf579f3f0320b2af1df66e5102e48eb1f5e3d" and "3e3178365d4aba8cc8856091197682500b6fe710" have entirely different histories.
4d5bf579f3
...
3e3178365d
25
main.tf
25
main.tf
|
@ -122,24 +122,23 @@ data "aws_ami" "latest_ecs" {
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_ami" "ubuntu" {
|
data "aws_ami" "ubuntu" {
|
||||||
most_recent = true
|
most_recent = true
|
||||||
owners = ["099720109477"]
|
owners = ["099720109477"] # Cannonical / Ubuntu
|
||||||
|
|
||||||
# Ubuntu AMI ID search
|
filter {
|
||||||
filter {
|
name = "name"
|
||||||
name = "name"
|
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-24.04-amd64-server-*"]
|
||||||
values = ["ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*"]
|
}
|
||||||
}
|
|
||||||
|
filter {
|
||||||
|
name = "virtualization-type"
|
||||||
|
values = ["hvm"]
|
||||||
|
}
|
||||||
|
|
||||||
filter {
|
|
||||||
name = "virtualization-type"
|
|
||||||
values = ["hvm"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "ubuntu_instance" {
|
resource "aws_instance" "ubuntu_instance" {
|
||||||
ami = data.aws_ami.ubuntu.id
|
ami = data.aws_ami.ubuntu.ami # Ubuntu "ami-0a0e5d9c7acc336f1"
|
||||||
# Ubuntu "ami-0a0e5d9c7acc336f1"
|
|
||||||
# ami = data.aws_ami.latest_ecs.ami # Amazon Linux
|
# ami = data.aws_ami.latest_ecs.ami # Amazon Linux
|
||||||
instance_type = var.instance_size
|
instance_type = var.instance_size
|
||||||
subnet_id = aws_subnet.public_subnet.id
|
subnet_id = aws_subnet.public_subnet.id
|
||||||
|
|
|
@ -6,7 +6,6 @@ output "ubuntu_ami" {
|
||||||
output "private_key" {
|
output "private_key" {
|
||||||
value = tls_private_key.ssh_key.private_key_pem
|
value = tls_private_key.ssh_key.private_key_pem
|
||||||
description = "SSH Private Key (PEM format)"
|
description = "SSH Private Key (PEM format)"
|
||||||
sensitive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output "public_key" {
|
output "public_key" {
|
||||||
|
|
|
@ -44,11 +44,9 @@ variable "aws_region" {
|
||||||
variable "aws_access_key" {
|
variable "aws_access_key" {
|
||||||
description = "AWS Access Key"
|
description = "AWS Access Key"
|
||||||
type = string
|
type = string
|
||||||
sensitive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_secret_key" {
|
variable "aws_secret_key" {
|
||||||
description = "AWS Secret Key"
|
description = "AWS Secret Key"
|
||||||
type = string
|
type = string
|
||||||
sensitive = true
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue