Skip to content

Commit c99b76f

Browse files
javsanbel2javbeltran_expediaclaude
authored
feat: add LakeFormation table permissions for Glue stats vendor role (#336)
Added var `create_glue_stats_vendor_role_tbl_permissions` and corresponding `aws_lakeformation_permissions` resource granting DESCRIBE/INSERT/DELETE on all schema tables to the Glue stats service role in EGDP. Co-authored-by: javbeltran_expedia <javbeltran@expediagroup.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 03a6904 commit c99b76f

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

44
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).
55

6+
## [7.12.8] - 2026-04-15
7+
### Added
8+
- Added var `create_glue_stats_vendor_role_tbl_permissions` to create LakeFormation table permissions (`DESCRIBE`, `INSERT`, `DELETE`) for the Glue stats service role on all schemas.
9+
610
## [7.12.7] - 2026-04-13
711
### Added
812
- Added LakeFormation permissions for `glue_stats_service_role` on Glue databases and tables.

lf.tf

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ resource "aws_lakeformation_permissions" "hms_sys_loc_permissions" {
102102
}
103103

104104
resource "aws_lakeformation_permissions" "data_location_access_permissions" {
105-
for_each = var.disable_glue_db_init && var.create_lf_resource ? {
106-
for schema in local.catalog_data_location_access_producer_schemas : "${schema["schema_name"]}-${schema["producer_arn"]}" => schema
107-
} : {}
105+
for_each = var.disable_glue_db_init && var.create_lf_resource ? {
106+
for schema in local.catalog_data_location_access_producer_schemas : "${schema["schema_name"]}-${schema["producer_arn"]}" => schema
107+
} : {}
108108

109109
principal = each.value.producer_arn
110110
permissions = ["DATA_LOCATION_ACCESS"]
@@ -170,7 +170,7 @@ resource "aws_lakeformation_permissions" "readonly_client_permissions" {
170170
}) : {}
171171

172172
principal = each.value.client_arn
173-
permissions = ["DESCRIBE","SELECT"]
173+
permissions = ["DESCRIBE", "SELECT"]
174174

175175
table {
176176
database_name = aws_glue_catalog_database.apiary_glue_database[each.value.schema_name].name
@@ -352,6 +352,18 @@ resource "aws_lakeformation_permissions" "glue_stats_service_role_tbl_permission
352352
}
353353
}
354354

355+
resource "aws_lakeformation_permissions" "glue_stats_vendor_role_tbl_permissions" {
356+
for_each = var.enable_glue_stats && var.create_lf_resource && var.create_glue_stats_vendor_role_tbl_permissions ? local.schemas_info_map : {}
357+
358+
principal = aws_iam_role.lf_data_access[0].arn
359+
permissions = ["DESCRIBE", "INSERT", "DELETE"]
360+
361+
table {
362+
database_name = aws_glue_catalog_database.apiary_glue_database[each.key].name
363+
wildcard = true
364+
}
365+
}
366+
355367
resource "aws_iam_role" "lf_data_access" {
356368
count = var.create_lf_resource && var.create_lf_data_access_role ? 1 : 0
357369
name = "${local.instance_alias}-lf-data-access-role-${var.aws_region}"

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ variable "lf_catalog_producer_arns" {
627627
default = []
628628
}
629629

630-
variable lf_catalog_data_location_access_producer_arns {
630+
variable "lf_catalog_data_location_access_producer_arns" {
631631
description = "AWS IAM role ARNs granted `DATA_LOCATION_ACCESS` permissions on all database s3 locations using LakeFormation. NOTE this permission is not granted by `lf_catalog_producer_arns`"
632632
type = list(string)
633633
default = []
@@ -1221,6 +1221,12 @@ variable "enable_glue_stats" {
12211221
default = false
12221222
}
12231223

1224+
variable "create_glue_stats_vendor_role_tbl_permissions" {
1225+
description = "Create LakeFormation table permissions (DESCRIBE, INSERT, DELETE) for the Glue stats service role on all schemas."
1226+
type = bool
1227+
default = false
1228+
}
1229+
12241230
variable "splunk_hec_token" {
12251231
description = "The token used for authentication with the Splunk HTTP Event Collector (HEC). This is required for sending logs to Splunk. Compatible with both EC2 and FARGATE ECS task definitions."
12261232
type = string

0 commit comments

Comments
 (0)