Skip to content

Commit

Permalink
feat: expose on .org (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
arein committed Aug 7, 2023
1 parent 6216f9a commit cdee926
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions terraform/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,23 @@ resource "aws_route53_record" "dns_load_balancer" {
}
}

resource "aws_route53_record" "backup_dns_load_balancer" {
zone_id = var.backup_route53_zone_id
name = var.backup_fqdn
type = "A"

alias {
name = aws_lb.application_load_balancer.dns_name
zone_id = aws_lb.application_load_balancer.zone_id
evaluate_target_health = true
}
}

resource "aws_lb_listener_certificate" "backup_cert" {
listener_arn = aws_lb_listener.listener.arn
certificate_arn = var.backup_acm_certificate_arn
}

# IAM
resource "aws_iam_role" "ecs_task_execution_role" {
name = "${var.app_name}-ecs-task-execution-role"
Expand Down
12 changes: 12 additions & 0 deletions terraform/ecs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ variable "acm_certificate_arn" {
type = string
}

variable "backup_acm_certificate_arn" {
type = string
}

variable "backup_fqdn" {
type = string
}

variable "backup_route53_zone_id" {
type = string
}

variable "public_subnets" {
type = set(string)
}
Expand Down
11 changes: 11 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
locals {
app_name = "verify"
fqdn = terraform.workspace == "prod" ? var.public_url : "${terraform.workspace}.${var.public_url}"
backup_fqdn = replace(local.fqdn, ".com", ".org")
latest_release_name = data.github_release.latest_release.name
version = coalesce(var.image_version, substr(local.latest_release_name, 1, length(local.latest_release_name)))
}
Expand Down Expand Up @@ -30,6 +31,13 @@ module "dns" {
fqdn = local.fqdn
}

module "backup_dns" {
source = "github.com/WalletConnect/terraform-modules.git//modules/dns"

hosted_zone_name = replace(var.public_url, ".com", ".org")
fqdn = local.backup_fqdn
}

resource "aws_prometheus_workspace" "prometheus" {
alias = "prometheus-${terraform.workspace}-${local.app_name}"
}
Expand Down Expand Up @@ -97,6 +105,9 @@ module "ecs" {
public_subnets = module.vpc.public_subnets
region = var.region
route53_zone_id = module.dns.zone_id
backup_acm_certificate_arn = module.backup_dns.certificate_arn
backup_fqdn = local.backup_fqdn
backup_route53_zone_id = module.backup_dns.zone_id
vpc_cidr = module.vpc.vpc_cidr_block
vpc_id = module.vpc.vpc_id
redis_url = module.redis.endpoint
Expand Down

0 comments on commit cdee926

Please sign in to comment.