Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AymenSegni
Created April 12, 2020 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AymenSegni/dbee7f822e484e6a802de063b16bc411 to your computer and use it in GitHub Desktop.
Save AymenSegni/dbee7f822e484e6a802de063b16bc411 to your computer and use it in GitHub Desktop.
# * 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