Skip to content

Commit

Permalink
fix: init route53 with wildcard acm
Browse files Browse the repository at this point in the history
fix: init route53 with wildcard acm
  • Loading branch information
burib authored Nov 15, 2024
2 parents a8a15df + 062a52a commit 124d782
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_acm_certificate_validation" "wildcard_cert" {
resource "aws_route53_record" "wildcard_cert_validation" {
name = tolist(aws_acm_certificate.wildcard_cert.domain_validation_options)[0].resource_record_name
type = tolist(aws_acm_certificate.wildcard_cert.domain_validation_options)[0].resource_record_type
zone_id = var.should_create_hosted_zone ? aws_route53_zone.hosted_zone.zone_id : aws_route53_zone.this.zone_id
zone_id = aws_route53_zone.this.zone_id
records = [
tolist(aws_acm_certificate.wildcard_cert.domain_validation_options)[0].resource_record_value
]
Expand Down
26 changes: 23 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
output "environment" {
value = var.environment
description = "Environment where this stack has been deployed to."
output "wildcard_certificate_arn" {
description = "The ARN of the certificate"
value = element(concat(aws_acm_certificate_validation.wildcard_cert.*.certificate_arn, aws_acm_certificate.wildcard_cert.*.arn, [""]), 0)
}

output "hosted_zone_ns_records" {
description = "Name servers of the created hosted zone."
value = aws_route53_zone.this.name_servers
}

output "hosted_zone_arn" {
description = "The ARN of the hosted zone"
value = aws_route53_zone.this.arn
}

output "hosted_zone_id" {
description = "The ID of the hosted zone"
value = aws_route53_zone.this.zone_id
}

output "hosted_zone_name" {
description = "Name of the hosted zone. example.com"
value = aws_route53_zone.this.name
}

output "region" {
Expand Down
13 changes: 2 additions & 11 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
variable "environment" {
variable "domain" {
description = <<EOF
Environment variable used to tag resources created by this module.
**Example values are:**
- temp
- dev
- staging
- prod
**Notes:**
Put here your notes if there is any.
name of the domain. For example: example.com
EOF
type = string
}

0 comments on commit 124d782

Please sign in to comment.