-
Notifications
You must be signed in to change notification settings - Fork 4
/
asg.tf
68 lines (54 loc) · 1.47 KB
/
asg.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
resource "aws_autoscaling_group" "argo_tunnel_autoscaling_group" {
name = "${local.prefix}-asg"
max_size = 1
min_size = 1
desired_capacity = 1
health_check_grace_period = 300
health_check_type = "EC2"
force_delete = true
vpc_zone_identifier = var.private_subnet_ids
launch_template {
id = aws_launch_template.default.id
version = "$Latest"
}
tag {
key = "Name"
value = local.prefix
propagate_at_launch = true
}
}
resource "aws_launch_template" "default" {
name = "${local.prefix}-lt"
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 8
volume_type = "gp2"
encrypted = true
}
}
image_id = data.aws_ami.amazon-linux-2.id
instance_type = var.instance_type
key_name = local.prefix
iam_instance_profile {
name = aws_iam_instance_profile.profile.name
}
monitoring {
enabled = true
}
vpc_security_group_ids = [
aws_security_group.default.id,
]
tag_specifications {
resource_type = "instance"
tags = {
Name = local.prefix
}
}
user_data = base64encode(templatefile("${path.module}/user_data.sh", {
cert_pem_secret_id = aws_secretsmanager_secret.secret.id
my_service_url = var.my_service_url,
my_service_domain = var.my_service_domain,
my_service_hostname = var.my_service_hostname,
}))
}