From a83debde34306865f8c3f095b8dda2616c81b110 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Oct 2023 23:41:18 -0700 Subject: [PATCH] Validation and cert created for tmper --- infra/load-balancer/temper-tv-cert.tf | 30 +++++++++++++++++++++++++++ infra/load-balancer/variables.tf | 3 +++ 2 files changed, 33 insertions(+) create mode 100644 infra/load-balancer/temper-tv-cert.tf diff --git a/infra/load-balancer/temper-tv-cert.tf b/infra/load-balancer/temper-tv-cert.tf new file mode 100644 index 0000000..626d1ac --- /dev/null +++ b/infra/load-balancer/temper-tv-cert.tf @@ -0,0 +1,30 @@ +# Base cerificate for shockrah_xyz +################################## +resource "aws_acm_certificate" "temper_tv" { + domain_name = "*.temper.tv" + subject_alternative_names = [ "temper.tv" ] + validation_method = "DNS" + + lifecycle { + create_before_destroy = true + } +} + +# DNS RECORDS +############# +resource "aws_route53_record" "temper_tv_cert" { + zone_id = var.temper_zone + name = tolist(aws_acm_certificate.temper_tv.domain_validation_options)[0].resource_record_name + type = tolist(aws_acm_certificate.temper_tv.domain_validation_options)[0].resource_record_type + records = [ tolist(aws_acm_certificate.temper_tv.domain_validation_options)[0].resource_record_value ] + ttl = 300 +} + +# Validation configuration blocks used by terraform +################################################### +resource "aws_acm_certificate_validation" "temper_tv" { + certificate_arn = aws_acm_certificate.temper_tv.arn + validation_record_fqdns = [ aws_route53_record.temper_tv_cert.fqdn ] +} + + diff --git a/infra/load-balancer/variables.tf b/infra/load-balancer/variables.tf index 8673831..4c9ae2e 100644 --- a/infra/load-balancer/variables.tf +++ b/infra/load-balancer/variables.tf @@ -51,3 +51,6 @@ variable "project_athens_zone" { type = string } +variable "temper_zone" { + type = string +}