Update main.tf

This commit is contained in:
Ryan Malloy 2024-11-11 21:55:04 +00:00
parent fbc90a3b5f
commit 117cfe24e5
1 changed files with 77 additions and 6 deletions

83
main.tf
View File

@ -1,10 +1,10 @@
data "aws_ami" "mac" { data "aws_ami" "mac_11" {
most_recent = true most_recent = true
owners = ["amazon"] owners = ["amazon"]
filter { filter {
name = "name" name = "name"
values = [ values = [
"amzn-ec2-macos-10.15.7-*-*" "amzn-ec2-macos-11.7.4-*-*"
] ]
} }
filter { filter {
@ -14,6 +14,75 @@ data "aws_ami" "mac" {
] ]
} }
} }
data "aws_ami" "mac_12" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = [
"amzn-ec2-macos-12.7.3-*-*"
]
}
filter {
name = "owner-alias"
values = [
"amazon",
]
}
}
data "aws_ami" "mac_13" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = [
"amzn-ec2-macos-13.7-*-*"
]
}
filter {
name = "owner-alias"
values = [
"amazon",
]
}
}
data "aws_ami" "mac_14" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = [
"amzn-ec2-macos-14.7-*-*"
]
}
filter {
name = "owner-alias"
values = [
"amazon",
]
}
}
data "aws_ami" "mac_15" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = [
"amzn-ec2-macos-15.0-*-*"
]
}
filter {
name = "owner-alias"
values = [
"amazon",
]
}
}
module "vpc" { module "vpc" {
source = "terraform-aws-modules/vpc/aws" source = "terraform-aws-modules/vpc/aws"
version = "2.64.0" version = "2.64.0"
@ -44,14 +113,16 @@ resource "aws_security_group" "ssh" {
} }
} }
resource "aws_instance" "mac_instance_b" { # mac2-m2.metal # 4 performance cores, 4 efficiency cores 8vCPUs 24G Mem 10G Network 8G EBS
ami = data.aws_ami.mac.image_id # mac2-m2pro.metal # 8 performance cores, 4 efficiency cores 12vCPUs 32G Mem 10G Network 8G EBS
resource "aws_instance" "mac_instance" {
ami = data.aws_ami.mac_15.image_id
instance_type = "mac1.metal" instance_type = "mac1.metal"
key_name = var.ssh_key_name key_name = var.ssh_key_name
availability_zone = "eu-west-1b"
host_id = "h-002de77f93125e3c2"
subnet_id = module.vpc.public_subnets[1] subnet_id = module.vpc.public_subnets[1]
vpc_security_group_ids = [aws_security_group.ssh.id] vpc_security_group_ids = [aws_security_group.ssh.id]
} }
# ssh -i private_key.pem ec2-user@52.53.52.53 # ssh -i private_key.pem ec2-user@52.53.52.53