-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoutput.tf
52 lines (45 loc) · 1.81 KB
/
output.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
44
45
46
47
48
49
50
51
52
# generate inventory file for Ansible
resource "local_file" "inventorybuilder" {
content = templatefile("template.tpl",
{
#builderIP = aws_instance.builder.*.public_ip
jenkinsIP = aws_eip.jenkins.public_ip
pipelineIP = aws_eip.pipeline.public_ip
}
)
filename = "inventory.cfg"
depends_on = [aws_eip.jenkins,aws_instance.jenkins,aws_eip.pipeline,aws_instance.pipeline]
}
# generate jenkins config but put in the IP for the other VM to launch an agent on
resource "local_file" "jenkins_config" {
content = templatefile("roles/jenkins/tasks/jenkins.tpl",
{
pipelineIP = aws_eip.pipeline.public_ip
privateKeyVar = "$${readFile:/bitnami/jenkins/home/project}" #heads up I'm escaping $ with $. We need this for Jenkins to load the SSH private key later
}
)
filename = "roles/jenkins/tasks/jenkins.yml"
depends_on = [aws_eip.jenkins,aws_instance.jenkins,aws_eip.pipeline,aws_instance.pipeline]
}
# Update the IP for actual pipeline EC2 instance that'll host the HTML
resource "local_file" "pipeline_documentation" {
content = templatefile("capstone/ip.tpl",
{
pipelineIP = aws_eip.pipeline.public_ip
jenkinsIP = aws_eip.jenkins.public_ip
}
)
filename = "ip.txt"
depends_on = [aws_eip.jenkins,aws_instance.jenkins,aws_eip.pipeline,aws_instance.pipeline]
}
# Update the IP for actual pipeline EC2 instance that'll host the HTML
resource "local_file" "pipeline_weblinks" {
content = templatefile("weblinks.tpl",
{
pipelineIP = aws_eip.pipeline.public_ip
jenkinsIP = aws_eip.jenkins.public_ip
}
)
filename = "weblinks"
depends_on = [aws_eip.jenkins,aws_instance.jenkins,aws_eip.pipeline,aws_instance.pipeline]
}