2026-09-16 21:29:43 +00:00
|
|
|
resource "aws_instance" "this" {
|
|
|
|
|
ami = var.ami_id
|
2026-09-17 18:48:25 +00:00
|
|
|
instance_type = "t4g.small"
|
2026-09-16 21:29:43 +00:00
|
|
|
subnet_id = aws_subnet.public.id
|
2026-09-28 20:16:53 +00:00
|
|
|
private_ip = local.collector_private_ip
|
2026-09-16 21:29:43 +00:00
|
|
|
vpc_security_group_ids = [aws_security_group.this.id]
|
|
|
|
|
iam_instance_profile = aws_iam_instance_profile.this.name
|
2026-09-17 18:48:25 +00:00
|
|
|
associate_public_ip_address = true
|
|
|
|
|
user_data = local.user_data
|
2026-09-16 21:29:43 +00:00
|
|
|
user_data_replace_on_change = true
|
|
|
|
|
|
|
|
|
|
root_block_device {
|
2026-09-17 18:48:25 +00:00
|
|
|
volume_size = 20
|
2026-09-16 21:29:43 +00:00
|
|
|
volume_type = "gp3"
|
|
|
|
|
encrypted = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
metadata_options {
|
|
|
|
|
http_endpoint = "enabled"
|
|
|
|
|
http_tokens = "required"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tags = {
|
|
|
|
|
Name = "syslog-server"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-17 18:48:25 +00:00
|
|
|
locals {
|
|
|
|
|
user_data = templatefile("${path.module}/user_data.sh.tftpl", {
|
|
|
|
|
vector_yaml = templatefile("${path.module}/vector.yaml.tftpl", {
|
|
|
|
|
aws_region = var.aws_region
|
|
|
|
|
firehose_stream = aws_kinesis_firehose_delivery_stream.unifi.name
|
|
|
|
|
})
|
|
|
|
|
})
|
2026-09-16 21:29:43 +00:00
|
|
|
}
|