tout est fonctionnel
All checks were successful
terraform validation / Terraform (push) Successful in 11s
All checks were successful
terraform validation / Terraform (push) Successful in 11s
This commit is contained in:
parent
33ff1d1604
commit
4bfecd99cc
13
README.md
13
README.md
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
# ${REPO_NAME}
|
# terraform-cloudflare-dns-zone
|
||||||
|
|
||||||
${REPO_DESCRIPTION}
|
Gestion DNS pour CloudFlare
|
||||||
|
|
||||||
# A propos de
|
# A propos de
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ https://developer.hashicorp.com/terraform/install?product_intent=terraform
|
|||||||
# Démarrage manuel
|
# Démarrage manuel
|
||||||
|
|
||||||
~~~bash
|
~~~bash
|
||||||
git clone https://gitea.tips-of-mine.com${REPO_LINK}.git
|
git clone https://gitea.tips-of-mine.com/tips-of-mine/terraform-cloudflare-dns-zone.git
|
||||||
cd ${TEMPLATE_NAME}
|
cd terraform-cloudflare-dns-zone
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
# Utilisation du repository
|
# Utilisation du repository
|
||||||
@ -35,5 +35,10 @@ plan
|
|||||||
terraform plan
|
terraform plan
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
apply
|
||||||
|
~~~bash
|
||||||
|
terraform plan
|
||||||
|
~~~
|
||||||
|
|
||||||
# Buy me a coffe
|
# Buy me a coffe
|
||||||
<a href='https://ko-fi.com/R5R2KNI3N' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi4.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
<a href='https://ko-fi.com/R5R2KNI3N' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi4.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
10
main.tf
10
main.tf
@ -1,10 +0,0 @@
|
|||||||
#resource "cloudflare_zone_settings_override" "this" {
|
|
||||||
# name = "${var.cloudflare_zone}"
|
|
||||||
|
|
||||||
# settings {
|
|
||||||
# always_use_https = "on"
|
|
||||||
# tls_1_3 = "on"
|
|
||||||
# ssl = "strict"
|
|
||||||
# min_tls_version = "1.2"
|
|
||||||
# }
|
|
||||||
#}
|
|
@ -1,8 +0,0 @@
|
|||||||
#output "record" {
|
|
||||||
# value = cloudflare_record.foobar.hostname
|
|
||||||
#}
|
|
||||||
|
|
||||||
#output "metadata" {
|
|
||||||
# value = cloudflare_record.foobar.metadata
|
|
||||||
# sensitive = true
|
|
||||||
#}
|
|
@ -2,14 +2,13 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
cloudflare = {
|
cloudflare = {
|
||||||
source = "cloudflare/cloudflare"
|
source = "cloudflare/cloudflare"
|
||||||
version = "~> 4.46"
|
version = "~> 4.50"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
required_version = ">= 1.7.5"
|
required_version = ">= 1.7.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "cloudflare" {
|
provider "cloudflare" {
|
||||||
# email = var.cloudflare_email
|
|
||||||
api_token = var.cloudflare_api_token
|
api_token = var.cloudflare_api_token
|
||||||
# zone = var.cloudflare_zone
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
records_a.tf
26
records_a.tf
@ -1,17 +1,21 @@
|
|||||||
resource "cloudflare_record" "terraform" {
|
resource "cloudflare_record" "a-root" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "terraform"
|
comment = "Domain verification record A"
|
||||||
value = "82.66.77.254"
|
content = var.main_server
|
||||||
type = "A"
|
name = "a-root.tips-of-mine.com"
|
||||||
|
proxied = false
|
||||||
|
tags = []
|
||||||
ttl = 1
|
ttl = 1
|
||||||
proxied = true
|
type = "A"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "a-root" {
|
resource "cloudflare_record" "b-root" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
|
comment = "Domain verification record B"
|
||||||
|
content = var.main_server
|
||||||
name = "@"
|
name = "@"
|
||||||
value = var.main_server
|
|
||||||
type = "A"
|
|
||||||
ttl = 3600
|
|
||||||
proxied = false
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 3600
|
||||||
|
type = "A"
|
||||||
}
|
}
|
@ -1,17 +1,21 @@
|
|||||||
resource "cloudflare_record" "cname-www" {
|
resource "cloudflare_record" "cname-www" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "www"
|
comment = "Domain verification record C"
|
||||||
value = "${cloudflare_record.a-root.hostname}"
|
content = cloudflare_record.a-root.name
|
||||||
type = "CNAME"
|
name = "site"
|
||||||
ttl = 3600
|
|
||||||
proxied = false
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 3600
|
||||||
|
type = "CNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "cname-mail" {
|
resource "cloudflare_record" "cname-mail" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
|
comment = "Domain verification record D"
|
||||||
|
content = cloudflare_record.b-root.name
|
||||||
name = "mail"
|
name = "mail"
|
||||||
value = "ghs.googlehosted.com"
|
|
||||||
type = "CNAME"
|
|
||||||
ttl = 3600
|
|
||||||
proxied = false
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 3600
|
||||||
|
type = "CNAME"
|
||||||
}
|
}
|
@ -1,39 +1,62 @@
|
|||||||
resource "cloudflare_record" "mx-aspmx" {
|
resource "cloudflare_record" "mx-aspmx" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "@"
|
comment = "Domain verification record H"
|
||||||
value = "aspmx.l.google.com"
|
content = "aspmx.l.tips-of-mine.com"
|
||||||
type = "MX"
|
name = "@"
|
||||||
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "MX"
|
||||||
priority = 10
|
priority = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "mx-alt1" {
|
resource "cloudflare_record" "mx-alt1" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "@"
|
comment = "Domain verification record I"
|
||||||
value = "alt1.aspmx.l.google.com"
|
content = "alt1.aspmx.l.tips-of-mine.com"
|
||||||
type = "MX"
|
name = "@"
|
||||||
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "MX"
|
||||||
priority = 20
|
priority = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "mx-alt2" {
|
resource "cloudflare_record" "mx-alt2" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "@"
|
comment = "Domain verification record J"
|
||||||
value = "alt2.aspmx.l.google.com"
|
content = "alt2.aspmx.l.tips-of-mine.com"
|
||||||
type = "MX"
|
name = "@"
|
||||||
priority = 20
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "MX"
|
||||||
|
priority = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "cloudflare_record" "mx-alt3" {
|
resource "cloudflare_record" "mx-alt3" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "@"
|
comment = "Domain verification record K"
|
||||||
value = "alt3.aspmx.l.google.com"
|
content = "alt3.aspmx.l.tips-of-mine.com"
|
||||||
type = "MX"
|
name = "@"
|
||||||
priority = 30
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "MX"
|
||||||
|
priority = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "cloudflare_record" "mx-alt4" {
|
resource "cloudflare_record" "mx-alt4" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "@"
|
comment = "Domain verification record L"
|
||||||
value = "alt4.aspmx.l.google.com"
|
content = "alt4.aspmx.l.tips-of-mine.com"
|
||||||
type = "MX"
|
name = "@"
|
||||||
priority = 30
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "MX"
|
||||||
|
priority = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
#resource "cloudflare_record" "sip-tls-terraform-srv" {
|
resource "cloudflare_record" "sip-tls-terraform-srv" {
|
||||||
# zone_id = "$var.cloudflare_zone}"
|
zone_id = var.cloudflare_zone_id
|
||||||
# name = "_sip._tls"
|
comment = "Domain verification record M"
|
||||||
# type = "SRV"
|
data {
|
||||||
# data = {
|
service = "_sip"
|
||||||
# service = "_sip"
|
proto = "_tls"
|
||||||
# proto = "_tls"
|
name = "terraform-srv"
|
||||||
# name = "terraform-srv"
|
priority = 0
|
||||||
# priority = 0
|
weight = 0
|
||||||
# weight = 0
|
port = 443
|
||||||
# port = 443
|
target = "tips-of-mine.com"
|
||||||
# target = "tips-of-mine.com"
|
}
|
||||||
# }
|
name = "_sip._tls"
|
||||||
#}
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "SRV"
|
||||||
|
priority = 0
|
||||||
|
}
|
@ -1,23 +1,32 @@
|
|||||||
resource "cloudflare_record" "txt-amazonses" {
|
resource "cloudflare_record" "txt-amazonses" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "_amazonses"
|
comment = "Domain verification record E"
|
||||||
value = "xxxxxxxx"
|
content = "xxxxxxxx"
|
||||||
type = "TXT"
|
name = "_amazonses"
|
||||||
ttl = 300
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "TXT"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "txt-dmarc" {
|
resource "cloudflare_record" "txt-dmarc" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "_dmarc"
|
comment = "Domain verification record F"
|
||||||
value = "v=DMARC1; p=none; pct=100; rua=mailto:dmarc@tips-of-mine.com; sp=none; aspf=r;"
|
content = "v=DMARC1; p=none; pct=100; rua=mailto:dmarc@tips-of-mine.com; sp=none; aspf=r;"
|
||||||
type = "TXT"
|
name = "_dmarc"
|
||||||
ttl = 300
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "TXT"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "txt-mandrill-domainkey" {
|
resource "cloudflare_record" "txt-mandrill-domainkey" {
|
||||||
zone_id = var.cloudflare_zone
|
zone_id = var.cloudflare_zone_id
|
||||||
name = "mandrill._domainkey"
|
comment = "Domain verification record G"
|
||||||
value = "v=DKIM1; k=rsa; p=xxxxxxxx;"
|
content = "v=DKIM1; k=rsa; p=xxxxxxxx;"
|
||||||
type = "TXT"
|
name = "mandrill._domainkey"
|
||||||
ttl = 300
|
proxied = false
|
||||||
|
tags = []
|
||||||
|
ttl = 300
|
||||||
|
type = "TXT"
|
||||||
}
|
}
|
12
variables.tf
12
variables.tf
@ -1,23 +1,27 @@
|
|||||||
variable "cloudflare_email" {
|
variable "cloudflare_email" {
|
||||||
description = "L'adresse électronique associée au compte."
|
description = "L'adresse électronique associée au compte."
|
||||||
type = string
|
type = string
|
||||||
|
sensitive = true
|
||||||
default = "thedjinhn@gmail.com"
|
default = "thedjinhn@gmail.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cloudflare_api_token" {
|
variable "cloudflare_api_token" {
|
||||||
description = "Le jeton de l'API Cloudflare."
|
description = "Le jeton de l'API Cloudflare."
|
||||||
type = string
|
type = string
|
||||||
default = "EMVLdieKXA6X-ifx0tW0ELNQGde5XrJ3D8T-qcEY"
|
sensitive = true
|
||||||
|
default = "EiFZGvTTRwOgFB8-OiiNyuLGEPEZvqjM8ckpA-lA"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cloudflare_zone" {
|
variable "cloudflare_zone_id" {
|
||||||
description = "La zone DNS à laquelle ajouter l'enregistrement."
|
description = "La zone DNS à laquelle ajouter l'enregistrement."
|
||||||
type = string
|
type = string
|
||||||
default = "tips-of-mine.com"
|
sensitive = true
|
||||||
|
default = "82345d1f868f476b080d5ad04d39bd0c"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "main_server" {
|
variable "main_server" {
|
||||||
description = "Le serveur principal"
|
description = "Le serveur principal"
|
||||||
type = string
|
type = string
|
||||||
default = "82.66.77.254"
|
sensitive = true
|
||||||
|
default = "10.0.4.50"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user