Repository navigation
Expand file tree
/
Copy pathstubbornjava.tf
More file actions
63 lines (52 loc) · 1.48 KB
/
Copy pathstubbornjava.tf
File metadata and controls
63 lines (52 loc) · 1.48 KB
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
62
63
provider "aws" {
region = "us-east-1"
}
variable "amis" {
type = "map"
default = {}
}
# TODO: import stubbornjava-webapp
resource "aws_volume_attachment" "ebs_jenkins" {
device_name = "/dev/sdh"
volume_id = "${aws_ebs_volume.jenkins.id}"
instance_id = "${aws_instance.ci.id}"
skip_destroy = true
}
resource "aws_ebs_volume" "jenkins" {
availability_zone = "us-east-1a"
size = 100
type = "gp2"
tags {
Name = "jenkins"
Path = "/var/lib/jenkins"
}
}
resource "aws_instance" "ci" {
count = 1
ami = "${var.amis["amazon-linux-2017-09.1"]}"
disable_api_termination = true
iam_instance_profile = "jenkins"
instance_type = "t2.medium"
monitoring = false
subnet_id = "${element(data.aws_subnet_ids.public.ids, count.index)}"
key_name = "stubbornjava"
vpc_security_group_ids = ["sg-e10c3a94", "sg-1a39ad66"]
associate_public_ip_address = true
tags {
Name = "Jenkins"
Role = "ci"
}
root_block_device {
volume_type = "gp2"
volume_size = 10
delete_on_termination = true
}
user_data = <<USER_DATA
#cloud-config
bootcmd:
- [ cloud-init-per, once, mymkfs, mkfs.ext4, /dev/xvdh ]
- [ cloud-init-per, once, createjenkinsdir, mkdir, /var/lib/jenkins ]
mounts:
- [ /dev/xvdh, /var/lib/jenkins, "ext4", "defaults,noatime", "0", "0" ]
USER_DATA
}