Update main.tf
This commit is contained in:
parent
39e329c99e
commit
55d818834f
42
main.tf
42
main.tf
|
@ -64,9 +64,49 @@ shutdown -r -t 10;
|
|||
EOF
|
||||
}
|
||||
|
||||
# Get latest Windows Server 2012R2 AMI
|
||||
data "aws_ami" "windows-2012-r2" {
|
||||
most_recent = true
|
||||
owners = ["amazon"]
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["Windows_Server-2012-R2_RTM-English-64Bit-Base-*"]
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Windows Server 2016 AMI
|
||||
data "aws_ami" "windows-2016" {
|
||||
most_recent = true
|
||||
owners = ["amazon"]
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["Windows_Server-2016-English-Full-Base*"]
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Windows Server 2019 AMI
|
||||
data "aws_ami" "windows-2019" {
|
||||
most_recent = true
|
||||
owners = ["amazon"]
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["Windows_Server-2019-English-Full-Base*"]
|
||||
}
|
||||
}
|
||||
|
||||
# Get latest Windows Server 2022 AMI
|
||||
data "aws_ami" "windows-2022" {
|
||||
most_recent = true
|
||||
owners = ["amazon"]
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["Windows_Server-2022-English-Full-Base*"]
|
||||
}
|
||||
}
|
||||
|
||||
# Create EC2 Instance
|
||||
resource "aws_instance" "windows-server" {
|
||||
ami = data.aws_ami.windows-2019.id
|
||||
ami = data.aws_ami.windows-2022.id
|
||||
instance_type = var.windows_instance_type
|
||||
subnet_id = aws_subnet.public-subnet.id
|
||||
vpc_security_group_ids = [aws_security_group.aws-windows-sg.id]
|
||||
|
|
Loading…
Reference in New Issue