Defend against some mistakes
This commit is contained in:
parent
5e026b36c9
commit
e402db67ad
|
@ -71,6 +71,6 @@ resource "aws_lb_listener" "server_https" {
|
|||
resource "aws_autoscaling_attachment" "server" {
|
||||
count = local.ami_available ? 1 : 0
|
||||
|
||||
autoscaling_group_name = aws_autoscaling_group.server[0].name
|
||||
autoscaling_group_name = aws_autoscaling_group.server[count.index].name
|
||||
alb_target_group_arn = aws_lb_target_group.server.arn
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ resource "aws_launch_template" "server" {
|
|||
count = local.ami_available ? 1 : 0
|
||||
|
||||
name = "riju-server"
|
||||
image_id = data.aws_ami.server[0].id
|
||||
image_id = data.aws_ami.server[count.index].id
|
||||
instance_type = "t3.small"
|
||||
|
||||
security_group_names = [aws_security_group.server.name]
|
||||
|
@ -81,7 +81,7 @@ resource "aws_autoscaling_group" "server" {
|
|||
max_size = 3
|
||||
|
||||
launch_template {
|
||||
id = aws_launch_template.server[0].id
|
||||
id = aws_launch_template.server[count.index].id
|
||||
}
|
||||
|
||||
tags = concat(
|
||||
|
|
|
@ -28,6 +28,6 @@ resource "aws_backup_selection" "riju" {
|
|||
plan_id = aws_backup_plan.riju.id
|
||||
|
||||
resources = [
|
||||
aws_instance.dev_server[0].arn,
|
||||
aws_instance.dev_server[count.index].arn,
|
||||
]
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ resource "aws_security_group" "dev_server" {
|
|||
resource "aws_instance" "dev_server" {
|
||||
count = local.ssh_key_available ? 1 : 0
|
||||
|
||||
ami = data.aws_ami.ubuntu[0].id
|
||||
ami = data.aws_ami.ubuntu[count.index].id
|
||||
instance_type = "t3.2xlarge"
|
||||
ebs_optimized = true
|
||||
|
||||
security_groups = [aws_security_group.dev_server[0].name]
|
||||
security_groups = [aws_security_group.dev_server[count.index].name]
|
||||
|
||||
iam_instance_profile = aws_iam_instance_profile.dev_server.name
|
||||
key_name = data.external.env.result.SSH_KEY_NAME
|
||||
|
@ -69,6 +69,6 @@ resource "aws_eip" "dev_server" {
|
|||
|
||||
resource "aws_eip_association" "dev_server" {
|
||||
count = local.ssh_key_available ? 1 : 0
|
||||
instance_id = aws_instance.dev_server[0].id
|
||||
allocation_id = aws_eip.dev_server[0].id
|
||||
instance_id = aws_instance.dev_server[count.index].id
|
||||
allocation_id = aws_eip.dev_server[count.index].id
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue