feat: add mailserver
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
00ae60fb07
commit
3277efc713
4 changed files with 80 additions and 3 deletions
75
mailserver.tf
Normal file
75
mailserver.tf
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
resource "hcloud_floating_ip" "mail" {
|
||||||
|
type = "ipv4"
|
||||||
|
home_location = "fsn1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hcloud_rdns" "floating_mail" {
|
||||||
|
floating_ip_id = hcloud_floating_ip.mail.id
|
||||||
|
ip_address = hcloud_floating_ip.mail.ip_address
|
||||||
|
dns_ptr = "mail.escapeangle.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
data "cloudflare_zone" "escapeangle" {
|
||||||
|
filter = {
|
||||||
|
name = "escapeangle.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudflare_dns_record" "mail-a" {
|
||||||
|
zone_id = data.cloudflare_zone.escapeangle.id
|
||||||
|
|
||||||
|
name = "mail.escapeangle.com"
|
||||||
|
content = hcloud_floating_ip.mail.ip_address
|
||||||
|
type = "A"
|
||||||
|
ttl = "10800"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudflare_dns_record" "mail-mx" {
|
||||||
|
zone_id = data.cloudflare_zone.escapeangle.id
|
||||||
|
|
||||||
|
name = "escapeangle.com"
|
||||||
|
content = "mail.escapeangle.com"
|
||||||
|
type = "MX"
|
||||||
|
priority = 10
|
||||||
|
ttl = "10800"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudflare_dns_record" "mail-spf" {
|
||||||
|
zone_id = data.cloudflare_zone.escapeangle.id
|
||||||
|
|
||||||
|
name = "escapeangle.com"
|
||||||
|
content = "v=spf1 a:mail.escapeangle.com -all"
|
||||||
|
type = "TXT"
|
||||||
|
ttl = "10800"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudflare_dns_record" "mail-dkim" {
|
||||||
|
zone_id = data.cloudflare_zone.escapeangle.id
|
||||||
|
|
||||||
|
name = "mail._domainkey.escapeangle.com"
|
||||||
|
content = "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJEouqeGAu4u4+UJY6NfdiwIoRghb4nJksa3CEZKGgy5CHJrjZ68urRzeKJPkGau8bK/yW9vte4VJ4IlIStdmkwSNqwdnBB/klTW1WZijhpKgN7rTioitQz2B2gJzOt7m1fbt9+BCLiPCmz8V3HNm36DHr+N7a69py7K8YlzZnPQIDAQAB"
|
||||||
|
type = "TXT"
|
||||||
|
ttl = "10800"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudflare_dns_record" "mail-dmarc" {
|
||||||
|
zone_id = data.cloudflare_zone.escapeangle.id
|
||||||
|
|
||||||
|
name = "_dmarc.escapeangle.com"
|
||||||
|
content = "v=DMARC1; p=none"
|
||||||
|
type = "TXT"
|
||||||
|
ttl = "10800"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "mailserver" {
|
||||||
|
source = "./modules/server"
|
||||||
|
|
||||||
|
hostname = "mail-01"
|
||||||
|
dns_zone = "escapeangle.com"
|
||||||
|
location = "fsn1"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hcloud_floating_ip_assignment" "mail" {
|
||||||
|
floating_ip_id = hcloud_floating_ip.mail.id
|
||||||
|
server_id = module.mailserver.server_id
|
||||||
|
}
|
||||||
|
|
@ -5,3 +5,7 @@ output "ipv4_address" {
|
||||||
output "ipv6_address" {
|
output "ipv6_address" {
|
||||||
value = hcloud_server.server.ipv6_address
|
value = hcloud_server.server.ipv6_address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "server_id" {
|
||||||
|
value = hcloud_server.server.id
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ variable "hostname" {
|
||||||
variable "location" {
|
variable "location" {
|
||||||
type = string
|
type = string
|
||||||
description = "The datacenter location for the server"
|
description = "The datacenter location for the server"
|
||||||
default = "nbg1"
|
default = "fsn1"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "type" {
|
variable "type" {
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue