Skip to content

Commit

Permalink
refactor(access_identity): Fix varaibles to enable access identity
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricios committed Jul 30, 2018
1 parent 5c822f1 commit c694cb3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Terraform AWS S3 module
========================

Create a AWS S3 bickets optimized for static web hosting
Create a AWS S3 buckets optimized for static web hosting
4 changes: 2 additions & 2 deletions data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "aws_iam_policy_document" "access_identity" {
count = "${var.access_identity_arn != "" ? 1 : 0}"
count = "${var.access_identity ? 1 : 0}"
statement {
actions = ["s3:GetObject"]
resources = ["arn:aws:s3:::$${bucket_name}$${origin_path}*"]
Expand All @@ -22,7 +22,7 @@ data "aws_iam_policy_document" "access_identity" {
}

data "template_file" "access_identity" {
count = "${var.access_identity_arn != "" ? 1 : 0}"
count = "${var.access_identity ? 1 : 0}"
template = "${data.aws_iam_policy_document.access_identity.json}"

vars {
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "aws_s3_bucket" "this" {
}

resource "aws_s3_bucket_policy" "access_identity" {
count = "${var.access_identity_arn != "" ? 1 : 0}"
count = "${var.access_identity ? 1 : 0}"
bucket = "${aws_s3_bucket.this.id}"
policy = "${data.template_file.access_identity.rendered}"
}
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ variable "access_identity_arn" {
default = ""
}

variable "access_identity" {
default = false
}

variable "read_permissions" {
default = [
"s3:GetObject"
Expand Down

0 comments on commit c694cb3

Please sign in to comment.