diff --git a/modules/infra/submodules/cost-usage-report/glue.tf b/modules/infra/submodules/cost-usage-report/glue.tf index eb26c1f1..06f3d973 100644 --- a/modules/infra/submodules/cost-usage-report/glue.tf +++ b/modules/infra/submodules/cost-usage-report/glue.tf @@ -137,6 +137,4 @@ resource "aws_vpc_endpoint" "aws_glue_vpc_endpoint" { tags = { "Name" = "${var.deploy_id}-glue" } - - private_dns_enabled = true -} +} \ No newline at end of file diff --git a/modules/infra/submodules/cost-usage-report/lambda.tf b/modules/infra/submodules/cost-usage-report/lambda.tf index 146b7cea..3c3edc50 100644 --- a/modules/infra/submodules/cost-usage-report/lambda.tf +++ b/modules/infra/submodules/cost-usage-report/lambda.tf @@ -5,6 +5,8 @@ data "archive_file" "cur_initializer_zip" { source { content = templatefile("${local.templates_dir}/${local.aws_cur_initializer_template}", { cur_crawler = local.cur_crawler + glue_dns = aws_vpc_endpoint.aws_glue_vpc_endpoint.dns_entry[0].dns_name + glue_region = var.region }) filename = local.index_filename } diff --git a/modules/infra/submodules/cost-usage-report/templates/aws_cur_initializer.js.tftpl b/modules/infra/submodules/cost-usage-report/templates/aws_cur_initializer.js.tftpl index ab547e38..340df897 100644 --- a/modules/infra/submodules/cost-usage-report/templates/aws_cur_initializer.js.tftpl +++ b/modules/infra/submodules/cost-usage-report/templates/aws_cur_initializer.js.tftpl @@ -4,7 +4,10 @@ exports.handler = function(event, context, callback) { if (event.RequestType === 'Delete') { response.send(event, context, response.SUCCESS); } else { - const glue = new AWS.Glue(); + const glue = new AWS.Glue({ + 'endpoint': 'https://${glue_dns}', + 'region': '${glue_region}' + }); glue.startCrawler({ Name: '${cur_crawler}' }, function(err, data) { if (err) { const responseData = JSON.parse(this.httpResponse.body);