Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update S3 Logs SQS permissions to allow external account s3 logs bucket event notifications #298

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bea41c1
fix gluesync on k8s deployment
Feb 25, 2025
4be0d74
create lf resource
Feb 25, 2025
904a049
enable hybrid access
Feb 25, 2025
6b01a3a
fix
Feb 25, 2025
285be2e
fix
Feb 25, 2025
cfac2f6
fix
Feb 25, 2025
fafbc24
update provider to support lf hybrid access
Feb 25, 2025
e44f939
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
a30a2e4
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
64a6197
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
3cfb228
merge
javsanbel2 Feb 26, 2025
5d3ab9b
Merge branch 'master' into feature/lakeformation
javsanbel2 Feb 26, 2025
172d647
create_lf_resource variable
Feb 26, 2025
7c7b4c5
Expiration will be 0 when the S3 lifecycle rule is disabled
javsanbel2 Feb 26, 2025
9039193
Merge branch 'feature/fix-expiration' into feature/lakeformation
javsanbel2 Feb 26, 2025
af114f1
Merge branch 'feature/lakeformation' of github.com-opensource:Expedia…
javsanbel2 Feb 26, 2025
55db0cf
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
3eeddfe
Merge branch 'feature/s3-logs-sqs-permission-to-allow-external-s3-log…
Feb 26, 2025
15bdac8
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
82c39f0
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
073aaa8
feat: Update S3 Logs SQS permissions to allow external account s3 log…
Feb 25, 2025
cb24049
Merge branch 'feature/s3-logs-sqs-permission-to-allow-external-s3-log…
Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ 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).

## [7.9.9] - 2025-02-25
### Added
- Update S3 Logs SQS permissions to allow multiple s3 logs buckets to report event notifications.

## [7.9.8] - 2025-02-25
### Added
- Update S3 Logs SQS permissions to allow multiple s3 logs buckets to report event notifications.

## [7.9.7] - 2025-02-26
### Added
- Update S3 Logs SQS permissions to allow multiple s3 logs buckets to report event notifications.

## [7.9.6] - 2025-02-26
### Fixed
- Expiration will be 0 when the S3 lifecycle rule is disabled.
Expand Down
2 changes: 2 additions & 0 deletions common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ locals {
enable_apiary_s3_log_management = var.apiary_log_bucket == "" ? true : false
enable_apiary_s3_log_hive = var.apiary_log_bucket == "" && var.enable_apiary_s3_log_hive ? true : false
apiary_s3_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_bucket_prefix}-s3-logs" : ""
s3_logs_bucket = var.s3_logs_buckets_csv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is needed?

s3_logs_bucket_list = concat(["arn:aws:s3:::${local.apiary_s3_logs_bucket}"], [for bucket in split(",", var.s3_logs_buckets_csv):"arn:aws:s3:::${bucket}"])
apiary_s3_hive_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_s3_logs_bucket}-hive" : ""
apiary_system_bucket = "${local.apiary_bucket_prefix}-${replace(var.system_schema_name, "_", "-")}"

Expand Down
14 changes: 14 additions & 0 deletions lf.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/

resource "aws_lakeformation_resource" "apiary_data_bucket" {
for_each = var.create_lf_resource ? {
for schema in local.schemas_info : "${schema["schema_name"]}" => schema
} : {}
arn = aws_s3_bucket.apiary_data_bucket[each.key].arn

hybrid_access_enabled = true
}
7 changes: 6 additions & 1 deletion sns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ resource "aws_sqs_queue" "apiary_managed_logs_queue" {
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:*:*:${local.instance_alias}-s3-logs-queue",
"Condition":{
"ArnEquals":{"aws:SourceArn":"arn:aws:s3:::${local.apiary_s3_logs_bucket}"}
"ArnEquals":{
"aws:SourceArn": [
"arn:aws:s3:::${local.apiary_s3_logs_bucket}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you did not use s3_logs_bucket_list which included the apiary internal log bucket and the external log buckets.

"arn:aws:s3:::${local.s3_logs_bucket}"
]
}
}
}
]
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ variable "s3_logs_sqs_receive_wait_time_seconds" {
default = 10
}

variable "s3_logs_buckets_csv" {
description = "This is the s3 logs buckets separated by comma where the s3 logs sqs should receive event notifications from f.i: 'bucketname1,bucketname2...'"
type = string
default = ""
}

variable "enable_hive_metastore_metrics" {
description = "Enable sending Hive Metastore metrics to CloudWatch."
type = bool
Expand Down Expand Up @@ -585,6 +591,12 @@ variable "rw_ingress_cidr" {
default = []
}

variable "create_lf_resource" {
description = "Register data buckets in LakeFormation."
type = bool
default = false
}

variable "disable_glue_db_init" {
description = "Glue databases are created programatically by default in hms-readwrite bootstrap init action. Setting this variable to true will disable the hms-readwrite bootstrap init action and create Glue databases via Terraform."
type = bool
Expand Down
4 changes: 2 additions & 2 deletions version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
version = ">= 5.17.0"
}
external = {
source = "hashicorp/external"
Expand All @@ -28,7 +28,7 @@ terraform {
version = "3.25.0"
}
template = {
source = "hashicorp/template"
source = "hashicorp/template"
version = "~> 2.2"
}
}
Expand Down
Loading