-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
49 lines (41 loc) · 1.76 KB
/
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
41
42
43
44
45
46
47
48
49
resource "aws_instance" "automq_byoc_console" {
ami = data.aws_ami.console_ami.id
instance_type = var.automq_byoc_ec2_instance_type
subnet_id = local.automq_byoc_env_console_public_subnet_id
vpc_security_group_ids = [aws_security_group.automq_byoc_console_sg.id]
iam_instance_profile = aws_iam_instance_profile.automq_byoc_instance_profile.name
root_block_device {
volume_size = 20
volume_type = "gp3"
}
tags = {
Name = "automq-byoc-console-${var.automq_byoc_env_id}"
automqVendor = "automq"
automqEnvironmentID = var.automq_byoc_env_id
}
associate_public_ip_address = true
# Initialize the AutoMQ BYOC console configuration
user_data = templatefile("${path.module}/tpls/userdata.tpl", {
aws_iam_instance_profile_arn_encoded = local.aws_iam_instance_profile_arn_encoded,
automq_data_bucket = local.automq_data_bucket,
automq_ops_bucket = local.automq_ops_bucket,
instance_security_group_id = aws_security_group.automq_byoc_console_sg.id,
instance_dns = aws_route53_zone.private_r53.zone_id,
instance_profile_arn = aws_iam_instance_profile.automq_byoc_instance_profile.arn,
environment_id = var.automq_byoc_env_id
})
}
resource "aws_ebs_volume" "data_volume" {
availability_zone = data.aws_subnet.public_subnet_info.availability_zone
size = 20
type = "gp3"
tags = {
automqVendor = "automq"
automqEnvironmentID = var.automq_byoc_env_id
}
}
resource "aws_volume_attachment" "data_volume_attachment" {
device_name = "/dev/sdh"
volume_id = aws_ebs_volume.data_volume.id
instance_id = aws_instance.automq_byoc_console.id
}