From 5362ec69a1c0ddf38344cbfe562594767200cae8 Mon Sep 17 00:00:00 2001 From: Dimitrios Karagiannis Date: Tue, 16 Apr 2019 16:13:33 +0100 Subject: [PATCH] Introduce user_policy variable This allows us to provide a custom IAM policy for the generated IAM machine user. Similar to bucket_policy, it is treated as a template. --- README.md | 1 + example/s3.tf | 74 ++++++++++++++++++++++++++++++++++++++------------- main.tf | 10 ++++++- variables.tf | 5 ++++ 4 files changed, 70 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index ea78128..6dc1115 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ module "example_team_s3" { |------|-------------|:----:|:-----:|:-----:| | acl | acl manages access to your bucket | string | `private` | no | | bucket_policy | The S3 bucket policy to set. If empty, no policy will be set | string | `""` | no | +| bucket_policy | The IAM policy to assign to the generated user. If empty, the default policy is used | string | `""` | no | | versioning | version objects stored within your bucket. | boolean | `false` | no | ### Tags diff --git a/example/s3.tf b/example/s3.tf index ae0f3bb..6147109 100644 --- a/example/s3.tf +++ b/example/s3.tf @@ -16,31 +16,67 @@ module "example_team_s3_bucket" { aws-s3-region = "eu-west-2" /* - * This is an example of a bucket policy. It is treated as a template so that - * variable can be used to avoid hardcoding values. Currently, the only - * available variable is `$${bucket_arn}`. + * The following are exampls of bucket and user policies. They are treated as + * templates. Currently, the only available variable is `$${bucket_arn}`. * + */ - bucket_policy = <