forked from LandmakTechnology/elk-with-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
null-resource.tf
40 lines (34 loc) · 1.03 KB
/
null-resource.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
# Create a Null Resource and Provisioners
resource "null_resource" "my_null_resource" {
depends_on = [time_sleep.wait_for_instance]
# Connection Block for Provisioners to connect to the EC2 Instance
connection {
host = aws_eip.ip.public_ip
type = "ssh"
user = var.instance_user
private_key = file("${path.module}/mykey/ansible-infra-test.pem")
}
provisioner "file" {
source = "scripts/elasticsearch.yml"
destination = "/tmp/elasticsearch.yml"
}
provisioner "file" {
source = "scripts/kibana.yml"
destination = "/tmp/kibana.yml"
}
provisioner "file" {
source = "scripts/apache-01.conf"
destination = "/tmp/apache-01.conf"
}
provisioner "file" {
source = "scripts/installELK.sh"
destination = "/tmp/installELK.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/installELK.sh",
"sudo sed -i -e 's/\r$//' /tmp/installELK.sh", # Remove the spurious CR characters.
"sudo /tmp/installELK.sh",
]
}
}