Skip to content

Commit

Permalink
Making logging configurable (#60)
Browse files Browse the repository at this point in the history
* Making logging configurable
* Setting a default for bucket name
* set the default to true
* Adding the new variable into tests
  • Loading branch information
mohsen0 authored and brandonjbjelland committed Apr 9, 2018
1 parent abd6265 commit dd8876d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ script:
-
- terraform init
- terraform fmt -check=true
- terraform validate -var "region=${AWS_REGION}" -var "subnets=[]" -var "vpc_id=vpc-abcde012" -var "load_balancer_name=my-lb" -var "log_bucket_name=my-log-bucket" -var "security_groups=[]"
- terraform validate -var "region=${AWS_REGION}" -var "subnets=[]" -var "vpc_id=vpc-abcde012" -var "load_balancer_name=my-lb" -var "log_enable=true" -var "log_bucket_name=my-log-bucket" -var "security_groups=[]"
- docker run --rm -v $(pwd):/app/ --workdir=/app/ -t wata727/tflint --error-with-issues
- cd examples/alb_test_fixture
- terraform init
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resource "aws_lb" "application" {
tags = "${merge(var.tags, map("Name", var.load_balancer_name))}"

access_logs {
enabled = true
enabled = "${var.log_enable}"
bucket = "${var.log_bucket_name}"
prefix = "${var.log_location_prefix}"
}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ variable "load_balancer_update_timeout" {
default = "10m"
}

variable "log_enable" {
description = "Enable logging"
default = true
}

variable "log_bucket_name" {
description = "S3 bucket (externally created) for storing load balancer access logs."
default = ""
}

variable "log_location_prefix" {
Expand Down

0 comments on commit dd8876d

Please sign in to comment.