This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linode.tf
77 lines (69 loc) · 1.72 KB
/
linode.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
65
66
67
68
69
70
71
72
73
74
75
76
77
terraform {
required_providers {
linode = {
source = "linode/linode"
}
}
}
provider "linode" {
token = var.token
api_version = "v4beta"
}
resource "linode_instance" "debiL" {
label = "debian-us-southeast"
image = "linode/debian11"
region = var.region
type = "g6-nanode-1"
authorized_keys = [var.ssh_key]
root_pass = var.root_pass
}
resource "linode_domain" "dominio_linode" {
domain = "eclaros.xyz"
soa_email = "[email protected]"
type = "master"
}
resource "linode_domain_record" "domain_linode_record" {
domain_id = linode_domain.dominio_linode.id
name = "www"
record_type = "A"
target = linode_instance.debiL.ip_address
ttl_sec = 300
}
# Add a record to the domain
resource "linode_domain_record" "mail" {
domain_id = linode_domain.dominio_linode.id
record_type = "A"
name = "mail"
ttl_sec = "30"
target = linode_instance.debiL.ip_address
}
# Add mx record to the domain (so it can receive emails)
resource "linode_domain_record" "mx" {
domain_id = linode_domain.dominio_linode.id
record_type = "MX"
name = ""
priority = "10"
ttl_sec = "14400"
target = "mail.eclaros.xyz"
}
# SPF
resource "linode_domain_record" "spf" {
domain_id = linode_domain.dominio_linode.id
record_type = "TXT"
name = ""
target = "v=spf1 include:spf.eclaros.xyz -all"
ttl_sec = "14400"
}
# DMARC
resource "linode_domain_record" "dmarc" {
domain_id = linode_domain.dominio_linode.id
record_type = "TXT"
name = "_dmarc"
target = "v=DMARC1;v=DMARC1; p=none; rua=mailto:[email protected]"
}
variable "token" {}
variable "root_pass" {}
variable "ssh_key" {}
variable "region" {
default = "us-southeast"
}