Skip to content

Commit

Permalink
🐛 fix(dns): create alias record for lb
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Oct 17, 2024
1 parent 39f4989 commit 18ad3f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ Change logs are auto-generated with commitizen.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_cname_cluster_domain"></a> [cname\_cluster\_domain](#module\_cname\_cluster\_domain) | git@github.e.it.census.gov:terraform-modules/aws-dns//cname | n/a |
No modules.

## Resources

| Name | Type |
|------|------|
| [aws_route53_record.entry](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_vpc_association_authorization.self_zone_east](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource |
| [aws_route53_vpc_association_authorization.self_zone_west](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_vpc_association_authorization) | resource |
| [aws_route53_zone.cluster_domain](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource |
Expand All @@ -48,7 +47,7 @@ Change logs are auto-generated with commitizen.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | EKS cluster name name component used through out the EKS cluster describing its purpose (ex: dice-dev) | `string` | n/a | yes |
| <a name="input_istio_ingress_lb"></a> [istio\_ingress\_lb](#input\_istio\_ingress\_lb) | The istio ingress load balancer DNS. | `string` | n/a | yes |
| <a name="input_istio_ingress_lb"></a> [istio\_ingress\_lb](#input\_istio\_ingress\_lb) | The istio ingress load balancer DNS. | `map(string)` | <pre>{<br> "dns_name": "abc-123.elb.region.amazonaws.com",<br> "zone_id": "ZABC123455"<br>}</pre> | no |
| <a name="input_os_username"></a> [os\_username](#input\_os\_username) | OS username from environment variable, ideally as $USER | `string` | `null` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS config region | `string` | `""` | no |
| <a name="input_region_map"></a> [region\_map](#input\_region\_map) | AWS region map | `map(string)` | <pre>{<br> "east": "us-gov-east-1",<br> "west": "us-gov-west-1"<br>}</pre> | no |
Expand Down
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ resource "aws_route53_zone_association" "self_zone_west" {
# Cluster DNS CNAME MAPPED TO INGRESS NLB
###################################################################

module "cname_cluster_domain" {
# tflint-ignore: terraform_module_pinned_source
source = "git@github.e.it.census.gov:terraform-modules/aws-dns//cname"

name = format("*.%v", local.cluster_domain_name)
values = [var.istio_ingress_lb]
zone = aws_route53_zone.cluster_domain.zone_id
enable_heritage = false
resource "aws_route53_record" "entry" {
zone_id = aws_route53_zone.cluster_domain.zone_id
name = "*.${local.cluster_domain_name}"
type = "CNAME"

alias {
name = var.istio_ingress_lb.dns_name
zone_id = var.istio_ingress_lb.zone_id
evaluate_target_health = true
}
}
6 changes: 5 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ variable "os_username" {

variable "istio_ingress_lb" {
description = "The istio ingress load balancer DNS."
type = string
type = map(string)
default = {
dns_name = "abc-123.elb.region.amazonaws.com"
zone_id = "ZABC123455"
}
}

variable "region_map" {
Expand Down

0 comments on commit 18ad3f9

Please sign in to comment.