Commit c6e1fe87 authored by Adrian Horrocks's avatar Adrian Horrocks

changes to invalid bucket name and adding logs to elb

parent c3fab279
...@@ -67,6 +67,14 @@ variable "health_check_interval" { ...@@ -67,6 +67,14 @@ variable "health_check_interval" {
default = "30" default = "30"
} }
variable "logs_enabled" {
default = "true"
}
variable "logs_interval" {
default = "5"
}
############################################################################################################# #############################################################################################################
# Security Group # Security Group
############################################################################################################# #############################################################################################################
...@@ -129,6 +137,12 @@ resource "aws_elb" "main" { ...@@ -129,6 +137,12 @@ resource "aws_elb" "main" {
instance_protocol = "${var.service_protocol}" instance_protocol = "${var.service_protocol}"
} }
access_logs {
enabled = "${var.logs_enabled}"
bucket = "${var.name}-elb-logs"
interval = "${var.logs_interval}"
}
health_check { health_check {
healthy_threshold = "${var.health_check_healthy_threshold}" healthy_threshold = "${var.health_check_healthy_threshold}"
unhealthy_threshold = "${var.health_check_unhealthy_threshold}" unhealthy_threshold = "${var.health_check_unhealthy_threshold}"
...@@ -146,7 +160,7 @@ resource "aws_elb" "main" { ...@@ -146,7 +160,7 @@ resource "aws_elb" "main" {
data "aws_elb_service_account" "main" {} data "aws_elb_service_account" "main" {}
resource "aws_s3_bucket" "elb_logs" { resource "aws_s3_bucket" "elb_logs" {
bucket = "${var.name}-elb_logs" bucket = "${var.name}-elb-logs"
acl = "private" acl = "private"
policy = <<POLICY policy = <<POLICY
...@@ -159,7 +173,7 @@ resource "aws_s3_bucket" "elb_logs" { ...@@ -159,7 +173,7 @@ resource "aws_s3_bucket" "elb_logs" {
"s3:PutObject" "s3:PutObject"
], ],
"Effect": "Allow", "Effect": "Allow",
"Resource": "arn:aws:s3:::${var.name}-elb_logs/AWSLogs/*", "Resource": "arn:aws:s3:::${var.name}-elb-logs/AWSLogs/*",
"Principal": { "Principal": {
"AWS": [ "AWS": [
"${data.aws_elb_service_account.main.arn}" "${data.aws_elb_service_account.main.arn}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment