               ;; alerting server needs access to all servers
               (vpc-security-group "nrpe" {})
 
-
               (database {:name (vpc-unique "alerts")
                          :subnet vpc-name})
 

  (:require [terraboot.core :refer :all]
            [terraboot.utils :refer :all]
            [terraboot.cloud-config :refer [cloud-config]]
            [cheshire.core :as json]))

(def logstash-user-data (cloud-config {:package_update true
                                       :bootcmd ["echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections"
                                                 "wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | apt-key add -" ]
                                       :apt_sources [{:source "ppa:webupd8team/java"}
                                                     {:source "deb http://packages.elastic.co/logstash/2.3/debian stable main"
                                                      :key (snippet "system-files/elasticsearch-apt.pem")}]
                                       :packages ["oracle-java8-installer"
                                                  "oracle-java8-set-default"
                                                  "logstash"]
                                       :runcmd ["update-rc.d logstash defaults"]
                                       :write_files [{:path "/etc/logstash/conf.d/out-es.conf"
                                                      :permissions "644"
                                                      :content (snippet "vpc-logstash/out-es.conf")}
                                                     {:path "/etc/logstash/conf.d/in-beats.conf"
                                                      :permissions "644"
                                                      :content (snippet "vpc-logstash/in-beats.conf")}
                                                     {:path "/etc/logstash/conf.d/in-gelf.conf"
                                                      :permissions "644"
                                                      :content (snippet "vpc-logstash/in-gelf.conf")}
                                                     {:path "/opt/logstash/patterns/basic-batterns"
                                                      :permissions "644"
                                                      :content (snippet "vpc-logstash/basic-patterns")}]}))

(defn elasticsearch-policy
  []

                                                   :subnet_id (vpc-id-of "aws_subnet" "private-a")
                                                   :associate_public_ip_address true
                                                   })

              (elb "kibana" resource {:name "kibana"
                                      :health_check {:healthy_threshold 2
