-
Notifications
You must be signed in to change notification settings - Fork 0
/
global-launch-configuration.tf
61 lines (57 loc) · 1.81 KB
/
global-launch-configuration.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
resource "random_id" "id_lc" {
byte_length = 8
}
resource "aws_launch_configuration" "ecs_asg_lc" {
name = "${var.stack_name}_${random_id.id_lc.hex}_lc"
image_id = var.image_id
instance_type = var.instance-type
iam_instance_profile = aws_iam_instance_profile.asg_ec2_instance_profile.name
security_groups = [aws_security_group.asg_ec2_devser.id]
user_data = <<EOF
#!/bin/bash
yum update -y
echo ECS_CLUSTER=${var.cluser_name} >> /etc/ecs/ecs.config
echo ${var.cluser_name}.local > /etc/hostname
echo 127.0.0.1 ${var.cluser_name}.local >> /etc/hosts
reboot
EOF
key_name = "ec2-e2msolutions-com"
associate_public_ip_address = true
enable_monitoring = true
root_block_device {
volume_type = "gp3"
volume_size = "30"
iops = "3000"
throughput = "400"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_launch_configuration" "shared_ecs_asg_lc" {
name = "${var.shared_cluster_name}_${random_id.id_lc.hex}_lc"
image_id = var.image_id
instance_type = var.instance-type
iam_instance_profile = aws_iam_instance_profile.asg_ec2_instance_profile.name
security_groups = [aws_security_group.asg_ec2_shared.id]
user_data = <<EOF
#!/bin/bash
yum update -y
echo ECS_CLUSTER=${var.shared_cluster_name} >> /etc/ecs/ecs.config
echo ${var.shared_cluster_name}.local > /etc/hostname
echo 127.0.0.1 ${var.shared_cluster_name}.local >> /etc/hosts
reboot
EOF
key_name = "ec2-e2msolutions-com"
associate_public_ip_address = true
enable_monitoring = true
root_block_device {
volume_type = "gp3"
volume_size = "30"
iops = "3000"
throughput = "400"
}
lifecycle {
create_before_destroy = true
}
}