Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# * acm.tf
# Create an AWS certificate for hello.aymen.krypton.berlin
resource "aws_acm_certificate" "cert" {
domain_name = aws_route53_record.hello.name
validation_method = "DNS"
tags = {
Environment = "Krypton"
Terraform = "true"
}
lifecycle {
create_before_destroy = true
}
}
# * dns.tf
# Data source dns zone
data "aws_route53_zone" "zone" {
name = var.zone_name
}
# The Application public LB created by the K8S deployment in /k8s-deployment
data "aws_elb" "lb" {
name = var.k8s_app_lb_name
}
# Create hello.aymen.krypton.berlin route53 record
resource "aws_route53_record" "hello" {
zone_id = data.aws_route53_zone.zone.zone_id
name = "hello.${data.aws_route53_zone.zone.name}"
type = "CNAME"
ttl = "300"
records = [data.aws_elb.lb.dns_name]
}
# * variables.tf
variable "k8s_app_lb_name" {
type = string
description = "the K8S app public LB"
}
variable "zone_name" {
type = string
default = "aymen.krypton.berlin."
description = "Main zone name"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment