Skip to content

Commit 24b5ef3

Browse files
author
Premdeep Saini
committed
remove count 1 from gitlab EC2 instance
1 parent ae92f12 commit 24b5ef3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

main.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ locals {
1111
}
1212

1313
resource "aws_instance" "gitlab" {
14-
count = 1
1514
ami = var.ami_id
1615
instance_type = var.instance_type
1716
subnet_id = var.private_subnet_id
@@ -234,8 +233,8 @@ module "elb" {
234233
unhealthy_threshold = var.healthcheck_unhealthy_threshold
235234
timeout = var.healthcheck_timeout
236235
}
237-
number_of_instances = length(aws_instance.gitlab)
238-
instances = aws_instance.gitlab[*].id
236+
number_of_instances = 1
237+
instances = tolist([aws_instance.gitlab.id])
239238

240239
tags = {
241240
Environment = var.environment_prefix
@@ -502,7 +501,7 @@ resource "null_resource" "gitlab_reconfigure" {
502501
timestamp = timestamp()
503502
}
504503
provisioner "local-exec" {
505-
command = "ansible-playbook -u ubuntu -i '${aws_instance.gitlab[0].private_ip},' --private-key ${var.private_key} -e 'instance_ip_address=${aws_instance.gitlab[0].private_ip} workdir=${local.gitlab_config_tmp_path} config_file=${local_sensitive_file.gitlab_config_file.filename}' ${local.gitlab_config_playbook_file}"
504+
command = "ansible-playbook -u ubuntu -i '${aws_instance.gitlab.private_ip},' --private-key ${var.private_key} -e 'instance_ip_address=${aws_instance.gitlab.private_ip} workdir=${local.gitlab_config_tmp_path} config_file=${local_sensitive_file.gitlab_config_file.filename}' ${local.gitlab_config_playbook_file}"
506505
}
507506
}
508507

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
output "gitlab_instance_id" {
22
description = "Instance Id of the Gitlab EC2 instance."
3-
value = aws_instance.gitlab[*].id
3+
value = aws_instance.gitlab.id
44
}
55

66
output "gitlab_sg_id" {

0 commit comments

Comments
 (0)