-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.tf
40 lines (34 loc) · 876 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"] # Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
#tfsec:ignore:aws-ec2-enforce-http-token-imds:exp:2025-01-02
resource "aws_instance" "this" {
ami = data.aws_ami.ubuntu.id
instance_type = "t3.micro"
root_block_device {
encrypted = true
}
dynamic "ebs_block_device" {
for_each = var.ebs_block_devices
iterator = device
content {
device_name = device.value["device_name"]
encrypted = device.value["encrypted"]
volume_size = device.value["volume_size"]
}
}
tags = {
Name = var.nome
Env = var.environment
Plataforma = data.aws_ami.ubuntu.platform_details
}
}