diff --git a/CHANGELOG.md b/CHANGELOG.md index 79b47e8..78d714f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ 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.1.0] - 2020-04-21 +### Added +- If Apiary's default S3 access log management is enabled (i.e., `var.apiary_log_bucket` is not set by the user), signal the Hive metastore to create the Hive database `s3_logs_hive` on startup. This is pre-work to prepare for S3 access-log Hive tables in a future version of Apiary. Requires `apiary-metastore-docker` version `1.13.0` or above. + + ## [6.0.0] - 2020-04-08 ### Added - Per-schema option to send S3 data notifications to an SQS queue. See `enable_data_events_sqs` in the [apiary_managed_schemas](VARIABLES.md#apiary_managed_schemas) section of [VARIABLES.md](VARIABLES.md) diff --git a/common.tf b/common.tf index 03730f5..b8858b5 100644 --- a/common.tf +++ b/common.tf @@ -29,6 +29,9 @@ locals { s3_inventory_prefix = "EntireBucketDaily" s3_inventory_bucket = var.s3_enable_inventory ? "${local.apiary_bucket_prefix}-s3-inventory" : "" create_sqs_data_event_queue = contains([for schema in local.schemas_info: lookup(schema, "enable_data_events_sqs", "0")], "1") ? true : false + enable_apiary_s3_log_management = var.apiary_log_bucket == "" ? true : false + apiary_s3_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_bucket_prefix}-s3-logs" : "" + apiary_s3_hive_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_s3_logs_bucket}-hive" : "" } data "aws_iam_account_alias" "current" {} diff --git a/iam-policy-s3-buckets.tf b/iam-policy-s3-buckets.tf index e573041..98b85a8 100644 --- a/iam-policy-s3-buckets.tf +++ b/iam-policy-s3-buckets.tf @@ -173,3 +173,53 @@ resource "aws_iam_role_policy" "s3_inventory_for_hms_readonly" { } EOF } + +resource "aws_iam_role_policy" "s3_access_logs_for_hms_readwrite" { + count = local.enable_apiary_s3_log_management ? 1 : 0 + name = "s3-access-logs" + role = "${aws_iam_role.apiary_hms_readwrite.id}" + + policy = <