forked from zoitech/terraform-aws-concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec2_instance.tf
37 lines (30 loc) · 942 Bytes
/
ec2_instance.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
data "aws_ami" "coreos" {
most_recent = true
owners = ["679593333241"]
filter {
name = "name"
values = ["CoreOS-${var.coreos_version}*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
resource "aws_instance" "ec2_docker_instance" {
ami = var.instance_ami
instance_type = var.instance_size
vpc_security_group_ids = flatten([aws_security_group.RuleGroupLBHttpIn[*].id, var.instance_sg_id, aws_security_group.GroupWS[*].id])
subnet_id = element(var.private_sn, 0)
key_name = var.instance_key_name
user_data = replace(data.template_file.userdata.rendered, "/\\r/", "")
iam_instance_profile = aws_iam_role.ec2_role.name
root_block_device {
volume_size = var.instance_volume_size
}
tags = {
Name = "${var.prefix}-${var.instance_name}"
}
lifecycle {
create_before_destroy = true
}
}