Skip to content

Commit

Permalink
Merge pull request #28 from controlshift/make_glue_connections_requir…
Browse files Browse the repository at this point in the history
…ements_mandatory

Fixes for setting up Glue jobs
  • Loading branch information
anero authored Nov 16, 2021
2 parents 542e1cf + 371a542 commit 609afc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
22 changes: 15 additions & 7 deletions glue_job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ resource "aws_glue_connection" "redshift_connection" {
JDBC_ENFORCE_SSL = false
}

dynamic "physical_connection_requirements" {
for_each = var.glue_physical_connection_requirements == null ? [] : list(var.glue_physical_connection_requirements)
content {
availability_zone = physical_connection_requirements.value.availability_zone
security_group_id_list = physical_connection_requirements.value.security_group_id_list
subnet_id = physical_connection_requirements.value.subnet_id
}
physical_connection_requirements {
availability_zone = var.glue_physical_connection_requirements.availability_zone
security_group_id_list = var.glue_physical_connection_requirements.security_group_id_list
subnet_id = var.glue_physical_connection_requirements.subnet_id
}
}

Expand Down Expand Up @@ -249,3 +246,14 @@ resource "aws_cloudwatch_event_target" "notify_failed_glue_job" {
target_id = "notify-failed-glue-job-run"
arn = aws_sns_topic.glue_job_failure.arn
}


data "aws_vpc" "main" {
id = var.vpc_id
}

# Glue jobs require a VPC endpoint for connecting to S3
resource "aws_vpc_endpoint" "s3" {
vpc_id = data.aws_vpc.main.id
service_name = "com.amazonaws.${var.aws_region}.s3"
}
6 changes: 5 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,9 @@ variable "lambda_loader_security_group_ids" {
variable "glue_physical_connection_requirements" {
type = object({ availability_zone=string, subnet_id=string, security_group_id_list=list(string) })
description = "A terraform map of the physical_connection_requirements property of the glue redshift connection. See Terraform aws_glue_connection docs."
default = null
}

variable "vpc_id" {
type = string
description = "The ID of the VPC Glue uses for connecting with Redshift"
}

0 comments on commit 609afc4

Please sign in to comment.