Skip to content

Commit

Permalink
Fix invalid bucket name
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Nemetz committed Dec 4, 2017
1 parent 4a01f0e commit b7b4cdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
resource "aws_s3_bucket" "this" {
count = "${length(var.names)}"
bucket = "${var.namespaced ?
format("%s-%s-%s", var.org, var.environment, element(var.names, count.index)) :
format("%s-%s", var.org, element(var.names, count.index))}"
format("%s-%s-%s", var.org, var.environment, replace(element(var.names, count.index), "_", "-")) :
format("%s-%s", var.org, replace(element(var.names, count.index), "_", "-"))}"
acl = "${var.public ? "public-read" : "private"}"
versioning {
enabled = "${var.versioned}"
Expand All @@ -42,8 +42,8 @@ resource "aws_s3_bucket" "this" {
tags = "${ merge(
var.tags,
map("Name", var.namespaced ?
format("%s-%s-s3-bucket", var.environment, element(var.names, count.index)) :
format("%s-s3-bucket", element(var.names, count.index)) ),
format("%s-%s", var.environment, replace(element(var.names, count.index), "_", "-")) :
format("%s", replace(element(var.names, count.index), "_", "-")) ),
map("Environment", var.environment),
map("Terraform", "true") )}"
}
Expand Down

0 comments on commit b7b4cdc

Please sign in to comment.