Skip to content

Commit 084f4e1

Browse files
rpoluripradeepbhadani
authored andcommitted
fixes #59 endpoint dns names when AWS_DEFAULT_REGION environment variable is not set. (#60)
1 parent ac7a520 commit 084f4e1

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ 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+
## [1.1.2] - TBD
7+
8+
### Changed
9+
- Fixes remote metastore CNAMEs when AWS_DEFAULT_REGION environment variable is not set - see[#59](https://github.com/ExpediaGroup/apiary-federation/issues/59)
10+
611
## [1.1.1] - 2019-04-09
712

813
### Added

endpoints.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ resource "aws_vpc_endpoint" "remote_metastores" {
4242

4343
data "external" "endpoint_dnsnames" {
4444
count = "${length(var.remote_metastores)}"
45-
program = ["bash", "${path.module}/scripts/endpoint_dns_name.sh", "${aws_vpc_endpoint.remote_metastores.*.id[count.index]}"]
45+
program = ["bash", "${path.module}/scripts/endpoint_dns_name.sh", "${aws_vpc_endpoint.remote_metastores.*.id[count.index]}", "${var.aws_region}"]
4646
}
4747

4848
data "template_file" "remote_metastores_yaml" {
@@ -72,10 +72,13 @@ data "template_file" "local_metastores_yaml" {
7272
}
7373

7474
resource "aws_route53_zone" "remote_metastore" {
75-
count = "${ var.enable_remote_metastore_dns == "" ? 0 : 1 }"
76-
name = "${local.remote_metastore_zone_prefix}-${var.aws_region}.${var.domain_extension}"
77-
vpc_id = "${var.vpc_id}"
78-
tags = "${var.tags}"
75+
count = "${ var.enable_remote_metastore_dns == "" ? 0 : 1 }"
76+
name = "${local.remote_metastore_zone_prefix}-${var.aws_region}.${var.domain_extension}"
77+
tags = "${var.tags}"
78+
79+
vpc = {
80+
vpc_id = "${var.vpc_id}"
81+
}
7982
}
8083

8184
resource "aws_route53_record" "metastore_alias" {

scripts/endpoint_dns_name.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
dns_name=`aws ec2 describe-vpc-endpoints --vpc-endpoint-ids $1|jq -r ".VpcEndpoints[].DnsEntries[0].DnsName"`
2+
dns_name=`aws --region $2 ec2 describe-vpc-endpoints --vpc-endpoint-ids $1|jq -r ".VpcEndpoints[].DnsEntries[0].DnsName"`
33
if [ "$dns_name" = "null" ]; then
44
echo "dns_name for VPC endpoint is null, one issue which may cause this is an older version of the AWS CLI on the machine you run Terraform from." 1>&2
55
exit 1

0 commit comments

Comments
 (0)