Files
mcp-nextcloud/infra/terraform/nextcloud-mcp-server/dns.tf
T
Chris CoutinhoandClaude Opus 4.7 ccf4b91bf9 feat(infra): distribute terraform modules under infra/terraform
POC: lift the homelab-grown nextcloud-mcp-server and
nextcloud-mcp-deployer-role Terraform modules into this repo so external
operators can consume them via a `git::` source.

Includes a top-level README documenting the two-phase deploy flow
(bootstrap deployer role with a copy-pasteable IAM policy, then assume the
role to deploy the MCP server) and supports both in-VPC Qdrant and
external/managed Qdrant modes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 22:21:41 +02:00

53 lines
1.3 KiB
Terraform

resource "random_pet" "subdomain" {
length = 2
separator = "-"
# Stable across applies; regenerate only if we point at a different zone.
keepers = {
zone_id = var.zone_id
}
}
locals {
fqdn = "${random_pet.subdomain.id}.${var.zone_name}"
}
resource "aws_acm_certificate" "this" {
domain_name = local.fqdn
validation_method = "DNS"
lifecycle {
create_before_destroy = true
}
tags = {
Name = "${var.name}-${random_pet.subdomain.id}"
}
}
resource "aws_route53_record" "cert_validation" {
allow_overwrite = true
zone_id = var.zone_id
name = one(aws_acm_certificate.this.domain_validation_options).resource_record_name
type = one(aws_acm_certificate.this.domain_validation_options).resource_record_type
records = [one(aws_acm_certificate.this.domain_validation_options).resource_record_value]
ttl = 60
}
resource "aws_acm_certificate_validation" "this" {
certificate_arn = aws_acm_certificate.this.arn
validation_record_fqdns = [aws_route53_record.cert_validation.fqdn]
}
resource "aws_route53_record" "alias" {
zone_id = var.zone_id
name = local.fqdn
type = "A"
alias {
name = aws_lb.this.dns_name
zone_id = aws_lb.this.zone_id
evaluate_target_health = true
}
}