-
Notifications
You must be signed in to change notification settings - Fork 2
/
instances.tf
43 lines (37 loc) · 1.33 KB
/
instances.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
resource "aws_instance" "neo4j_instance" {
count = var.node_count
ami = var.neo4j-ami-list["${var.neo4j_version}"]["${var.target_region}"]
instance_type = var.instance_type
key_name = aws_key_pair.neo4j_ec2_key.id
subnet_id = element(aws_subnet.neo4j_public_subnet.*.id, count.index % 3)
vpc_security_group_ids = ["${aws_security_group.neo4j_sg.id}"]
iam_instance_profile = aws_iam_instance_profile.neo4j_instance_profile.name
depends_on = [aws_lb.neo4j_lb]
user_data = templatefile(
"${path.module}/neo4j.tftpl",
{
install_gds = var.install_gds
install_bloom = var.install_bloom
gds_key = var.gds_key
bloom_key = var.bloom_key
neo4j_password = var.neo4j_password
install_apoc = var.install_apoc
node_count = var.node_count
lb_fqdn = aws_lb.neo4j_lb.dns_name
lb_arn = aws_lb.neo4j_lb.arn
neo4j_version = var.neo4j_version
target_region = var.target_region
env_prefix = var.env_prefix
}
)
tags = {
"Name" = "${var.env_prefix}-instance"
"Terraform" = true
}
// only set to true when developing/debugging. tf default = false
user_data_replace_on_change = false
// don't force-recreate instance if only user data changes
lifecycle {
ignore_changes = [user_data]
}
}