aboutsummaryrefslogtreecommitdiff
path: root/docs/bsky/didweb/pds.tf
blob: 257dc0a1d7bf5f0f2889adf79789d87679bc9563 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
data "aws_route53_zone" "within_website" {
  name = "within.website."
}

data "civo_ssh_key" "shiroko" {
  name = "shiroko"
}

data "civo_disk_image" "ubuntu" {
  filter {
    key    = "name"
    values = ["ubuntu-noble"]
  }
}

resource "civo_network" "pds" {
  label = "bsky-pds"
}

resource "civo_firewall" "pds" {
  name                 = "bsky-pds"
  network_id           = civo_network.pds.id
  create_default_rules = false

  ingress_rule {
    label      = "yolo"
    protocol   = "tcp"
    port_range = "1-65535"
    cidr       = ["0.0.0.0/0"]
    action     = "allow"
  }

  ingress_rule {
    label      = "yolo-udp"
    protocol   = "udp"
    port_range = "1-65535"
    cidr       = ["0.0.0.0/0"]
    action     = "allow"
  }

  egress_rule {
    label      = "yolo"
    protocol   = "tcp"
    port_range = "1-65535"
    cidr       = ["0.0.0.0/0"]
    action     = "allow"
  }

  egress_rule {
    label      = "yolo-udp"
    protocol   = "udp"
    port_range = "1-65535"
    cidr       = ["0.0.0.0/0"]
    action     = "allow"
  }
}

resource "civo_instance" "engram" {
  hostname    = "engram"
  tags        = ["xe", "pds"]
  notes       = "Bluesky PDS for pds.within.website"
  sshkey_id   = data.civo_ssh_key.shiroko.id
  firewall_id = civo_firewall.pds.id
  network_id  = civo_network.pds.id
  size        = "g4s.xsmall"
  disk_image  = data.civo_disk_image.ubuntu.diskimages[0].id
  script      = file("${path.module}/assimilate.sh")
  volume_type = "ms-xfs-2-replicas"
}

resource "aws_route53_record" "engram-within-website--A" {
  zone_id = data.aws_route53_zone.within_website.zone_id
  name    = "engram.${data.aws_route53_zone.within_website.name}"
  type    = "A"
  ttl     = "3600"
  records = [civo_instance.engram.public_ip]
}

resource "aws_route53_record" "star-engram-within-website--A" {
  zone_id = data.aws_route53_zone.within_website.zone_id
  name    = "*.engram.${data.aws_route53_zone.within_website.name}"
  type    = "A"
  ttl     = "3600"
  records = [civo_instance.engram.public_ip]
}