File tree Expand file tree Collapse file tree 5 files changed +24
-25
lines changed
Expand file tree Collapse file tree 5 files changed +24
-25
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ No requirements.
66
77| Name | Version |
88| ------| ---------|
9- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | n/a |
9+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.60.0 |
1010
1111## Modules
1212
@@ -17,7 +17,7 @@ No modules.
1717| Name | Type |
1818| ------| ------|
1919| [ aws_route53_record.record] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record ) | resource |
20- | [ aws_acm_certificate.base_domain_certificate ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate ) | data source |
20+ | [ aws_acm_certificate.domain ] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate ) | data source |
2121| [ aws_route53_zone.zone] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone ) | data source |
2222
2323## Inputs
@@ -26,8 +26,7 @@ No modules.
2626| ------| -------------| ------| ---------| :--------:|
2727| <a name =" input_alb_dns_name " ></a > [ alb\_ dns\_ name] ( #input\_ alb\_ dns\_ name ) | ALB DNS name | ` string ` | n/a | yes |
2828| <a name =" input_alb_zone_id " ></a > [ alb\_ zone\_ id] ( #input\_ alb\_ zone\_ id ) | ALB zone ID | ` string ` | n/a | yes |
29- | <a name =" input_base_domain " ></a > [ base\_ domain] ( #input\_ base\_ domain ) | The base domain for the Route 53 zone | ` string ` | n/a | yes |
30- | <a name =" input_endpoints " ></a > [ endpoints] ( #input\_ endpoints ) | A list of endpoints for which to create Route 53 records | ` list(string) ` | n/a | yes |
29+ | <a name =" input_domain " ></a > [ domain] ( #input\_ domain ) | Domain name | ` string ` | n/a | yes |
3130
3231## Outputs
3332
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ locals {
2+ domain_parts = regexall (" (.*\\ .)?(.*\\ ..*)" , var. domain )
3+ base_domain = length (local. domain_parts ) > 0 && length (local. domain_parts [0 ]) > 1 ? local. domain_parts [0 ][1 ] : var. domain
4+ }
5+
6+ data "aws_acm_certificate" "domain" {
7+ domain = local. base_domain
8+ statuses = [" ISSUED" ]
9+ most_recent = false
10+ }
11+
12+ data "aws_route53_zone" "zone" {
13+ name = local. base_domain
14+ }
15+
116resource "aws_route53_record" "record" {
2- for_each = toset (var. endpoints )
3- zone_id = data. aws_route53_zone . zone . zone_id
4- name = each. key
5- type = " A"
17+ zone_id = data. aws_route53_zone . zone . zone_id
18+ name = var. domain
19+ type = " A"
620
721 alias {
822 name = var. alb_dns_name
Original file line number Diff line number Diff line change 11output "certificate_arn" {
22 description = " ARN of the base domain certificate"
3- value = data. aws_acm_certificate . base_domain_certificate . arn
3+ value = data. aws_acm_certificate . domain . arn
44}
55
66output "zone_id" {
Original file line number Diff line number Diff line change 1- variable "base_domain " {
2- description = " The base domain for the Route 53 zone "
1+ variable "domain " {
2+ description = " Domain name "
33 type = string
44}
55
6- variable "endpoints" {
7- description = " A list of endpoints for which to create Route 53 records"
8- type = list (string )
9- }
10-
116variable "alb_dns_name" {
127 description = " ALB DNS name"
138 type = string
You can’t perform that action at this time.
0 commit comments