Skip to content

Commit 0806c13

Browse files
committed
refactor: extract glue catalog table name to variables
1 parent 0d73e83 commit 0806c13

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

locals.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ locals {
44
publish_cloudwatch_metrics_enabled_value = false
55

66
tables = {
7-
alb_access_logs = {
7+
(var.alb_access_logs_table_name) = {
88
location = "s3://${var.s3_bucket_name}/alb-access-logs/"
99
ser_de_name = "alb-access-logs-serde"
1010
ser_de_serialization_library = "org.apache.hadoop.hive.serde2.RegexSerDe"
@@ -54,7 +54,7 @@ locals {
5454
}
5555
}
5656

57-
alb_connection_logs = {
57+
(var.alb_connection_logs_table_name) = {
5858
location = "s3://${var.s3_bucket_name}/alb-connection-logs/"
5959
ser_de_name = "alb-connection-logs-serde"
6060
ser_de_serialization_library = "org.apache.hadoop.hive.serde2.RegexSerDe"

outputs.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
output "athena_workgroup_name" {
2+
description = "Name of the Athena Workgroup"
3+
value = aws_athena_workgroup.this.name
4+
}
5+
6+
output "glue_catalog_database_name" {
7+
description = "Name of the Glue catalog database"
8+
value = aws_glue_catalog_database.this.name
9+
}
10+
11+
output "alb_logs_bucket_name" {
12+
description = "S3 bucket name where ALB logs are retrieved"
13+
value = var.s3_bucket_name
14+
}
15+
16+
output "query_results_bucket_name" {
17+
description = "S3 bucket name where Athena query results are stored"
18+
value = var.query_results_bucket
19+
}
20+
21+
output "alb_access_logs_location" {
22+
description = "Location in S3 where ALB access logs are stored"
23+
value = local.tables[var.alb_access_logs_table_name].location
24+
}
25+
26+
output "alb_connection_logs_location" {
27+
description = "Location in S3 where ALB connection logs are stored"
28+
value = local.tables[var.alb_connection_logs_table_name].location
29+
}
30+
31+
output "glue_table_names" {
32+
description = "Names of the Glue tables under the database"
33+
value = [for table_name in keys(local.tables) : table_name]
34+
}

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ variable "s3_bucket_name" {
1717
description = "The name of the S3 bucket where ALB logs are stored."
1818
type = string
1919
}
20+
21+
variable "alb_access_logs_table_name" {
22+
description = "The table name for the alb access logs"
23+
type = string
24+
default = "alb_access_logs"
25+
}
26+
27+
variable "alb_connection_logs_table_name" {
28+
description = "The table name for the alb connection logs"
29+
type = string
30+
default = "alb_connection_logs"
31+
}

0 commit comments

Comments
 (0)