Skip to content

Commit

Permalink
Feature/s3 inventory customer accounts (#192)
Browse files Browse the repository at this point in the history
* variable to grant access to s3 inventory s3 bucket

* update changelog

Co-authored-by: Raj Poluri <[email protected]>
  • Loading branch information
rpoluri and Raj Poluri authored Jun 17, 2021
1 parent a1426b6 commit 68da907
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [6.8.1] - 2021-06-17
### Added
- Add support for cross account access to s3 inventory.

## [6.8.0] - 2021-05-10
### Added
- Add support for Apiary-specific RDS parameter groups.
Expand Down
1 change: 1 addition & 0 deletions VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
| ranger_policy_manager_url | Ranger admin URL to synchronize policies. | string | `` | no |
| rds_max_allowed_packet | RDS/MySQL setting for parameter 'max_allowed_packet' in bytes. | number | `134217728` | no |
| s3_enable_inventory | Enable S3 inventory configuration. | bool | `false` | no |
| s3_inventory_customer_accounts | AWS account IDs allowed to access s3 inventory database. | list | - | no |
| s3_inventory_format | Output format for S3 inventory results. Can be Parquet, ORC, CSV | string | `ORC` | no |
| s3_inventory_update_schedule | Cron schedule to update S3 inventory tables (if enabled). Defaults to every 12 hours. | string | `0 */12 * * *` | no |
| s3_lifecycle_policy_transition_period | Number of days for transition to a different storage class using lifecycle policy. | string | `30` | no |
Expand Down
20 changes: 20 additions & 0 deletions s3-other.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ resource "aws_s3_bucket" "apiary_inventory_bucket" {
}
}
},
%{if length(var.s3_inventory_customer_accounts) > 0}
{
"Sid": "S3 inventory customer account permissions",
"Effect": "Allow",
"Principal": {
"AWS": [ "${join("\",\"", formatlist("arn:aws:iam::%s:root", var.s3_inventory_customer_accounts))}" ]
},
"Action": [
"s3:GetBucketLocation",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:GetBucketAcl",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::${local.s3_inventory_bucket}",
"arn:aws:s3:::${local.s3_inventory_bucket}/*"
]
},
%{endif}
{
"Sid": "DenyUnSecureCommunications",
"Effect": "Deny",
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ variable "s3_inventory_format" {
default = "ORC"
}

variable "s3_inventory_customer_accounts" {
description = "AWS account IDs allowed to access s3 inventory database."
type = list(string)
default = []
}

variable "ranger_policy_manager_url" {
description = "Ranger admin URL to synchronize policies."
type = string
Expand Down

0 comments on commit 68da907

Please sign in to comment.