-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new example to sho wcreating an IAM policy for s3 buckets
- Loading branch information
Steven Nemetz
committed
May 18, 2018
1 parent
3b1c2ec
commit dfd9041
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Example: Managing multiple S3 buckets and create policy for them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "s3" { | ||
source = "../../" | ||
names = ["bucket-1", "bucket2", "bucket_3"] | ||
environment = "${var.environment}" | ||
organization = "${var.organization}" | ||
} | ||
|
||
data "aws_iam_policy_document" "s3" { | ||
statement { | ||
actions = ["s3:*"] | ||
effect = "Allow" | ||
resources = ["${formatlist("%s/*", module.s3.arns)}"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
output "arns" { | ||
description = "List of AWS S3 Bucket ARNs" | ||
value = "${module.s3.arns}" | ||
} | ||
|
||
output "domain_names" { | ||
description = "List of AWS S3 Bucket Domain Names" | ||
value = "${module.s3.domain_names}" | ||
} | ||
|
||
output "hosted_zone_ids" { | ||
description = "List of AWS S3 Bucket Hosted Zone IDs" | ||
value = "${module.s3.hosted_zone_ids}" | ||
} | ||
|
||
output "ids" { | ||
description = "List of AWS S3 Bucket IDs" | ||
value = "${module.s3.ids}" | ||
} | ||
|
||
output "names" { | ||
description = "List of AWS S3 Bucket Names" | ||
value = "${module.s3.names}" | ||
} | ||
|
||
output "regions" { | ||
description = "List of AWS S3 Bucket Regions" | ||
value = "${module.s3.regions}" | ||
} | ||
|
||
// Unique to this example | ||
output "policy" { | ||
value = "${data.aws_iam_policy_document.s3.json}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
provider "aws" { | ||
region = "${var.region}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
variable "environment" { | ||
default = "dev" | ||
} | ||
|
||
variable "organization" { | ||
default = "testorg" | ||
} | ||
|
||
variable "region" { | ||
default = "us-west-2" | ||
} |