-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging.tf.template
52 lines (48 loc) · 1.48 KB
/
logging.tf.template
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
variable "logdna_agent_url" {
default = ""
description = "URL for logdna agent"
}
variable "logdna_agent_access_key" {
default = ""
description = "Access key for logdna agent"
}
variable "logdna_agent_api_host" {
default = ""
description = "API host for logdna agent"
}
variable "logdna_agent_log_host" {
default = ""
description = "Host for logdna agent"
}
variable "logdna_agent_log_host" {
default = ""
description = "Tags for logdna agent"
}
resource "null_resource" "instance_logging" {
connection {
type = "ssh"
host = ibm_is_floating_ip.floatingip.address
user = "root"
private_key = tls_private_key.build_key.private_key_pem
}
# Configure and deploys the script that will be used to install the logging agent.
provisioner "file" {
content = templatefile("${path.module}/scripts/log-agent-config.sh", {
logdna_agent_url = var.logdna_agent_url
logdna_agent_access_key = var.logdna_agent_access_key
logdna_agent_api_host = var.logdna_agent_api_host
logdna_agent_log_host = var.logdna_agent_log_host
logdna_agent_tags = var.logdna_agent_tags
})
destination = "/tmp/log-agent-config.sh"
}
# Execute the script to install the logging agent.
provisioner "remote-exec" {
inline = [
"cloud-init status --wait",
"chmod +x /tmp/log-agent-config.sh",
"sed -i.bak 's/\r//g' /tmp/log-agent-config.sh",
"/tmp/log-agent-config.sh",
]
}
}