-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
64 lines (51 loc) · 1.56 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
provider "aws" {
region = var.region
default_tags {
tags = {
Name = "MastodonService"
}
}
}
locals {
cluster_name = "casuls-ecs-${random_string.suffix.result}"
domain_name = "casuls.social"
}
data "aws_availability_zones" "available" {}
module "domain" {
source = "./domain"
domain_name = local.domain_name
}
resource "random_string" "suffix" {
length = 8
special = false
}
module "mastodon_cluster" {
source = "./masto-cluster"
# VPC information
vpc_id = module.vpc.vpc_id
private_subnet_ids = module.vpc.private_subnets
public_subnet_ids = module.vpc.public_subnets
vpc_cidr_block = module.vpc.vpc_cidr_block
rds_subnet_group_name = module.vpc.database_subnet_group_name
elasticache_subnet_group_name = module.vpc.elasticache_subnet_group_name
# Domain information
domain_name = local.domain_name
zone_id = module.domain.zone_id
# Certificate information
certificate_arn = aws_acm_certificate_validation.mastodon.certificate_arn
# Admin user information
admin_user_name = "LavaHot"
admin_email_address = "[email protected]"
admin_initial_password = "password"
}
# Create an alias record for the load balancer
resource "aws_route53_record" "mastodon" {
zone_id = module.domain.zone_id
name = local.domain_name
type = "A"
alias {
name = module.mastodon_cluster.load_balancer_dns
zone_id = module.mastodon_cluster.load_balancer_zone_id
evaluate_target_health = false
}
}