Automation and setup for sites I own.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

205 regels
5.6 KiB

  1. variable "cloudflare_mitchty_net_zoneid" {
  2. type = string
  3. }
  4. resource "cloudflare_record" "ns1_mitchty_net" {
  5. zone_id = var.cloudflare_mitchty_net_zoneid
  6. name = "@"
  7. value = "mitch.ns.cloudflare.com"
  8. type = "NS"
  9. }
  10. resource "cloudflare_record" "ns2_mitchty_net" {
  11. zone_id = var.cloudflare_mitchty_net_zoneid
  12. name = "@"
  13. value = "tegan.ns.cloudflare.com"
  14. type = "NS"
  15. }
  16. resource "cloudflare_record" "root_mitchty_net" {
  17. depends_on = [
  18. linode_instance.prod,
  19. cloudflare_record.ns1_mitchty_net,
  20. cloudflare_record.ns2_mitchty_net ]
  21. zone_id = var.cloudflare_mitchty_net_zoneid
  22. name = "@"
  23. value = linode_instance.prod.ip_address
  24. type = "A"
  25. ttl = local.dns_ttl
  26. }
  27. resource "cloudflare_record" "splat_mitchty_net" {
  28. depends_on = [
  29. linode_instance.prod,
  30. cloudflare_record.ns1_mitchty_net,
  31. cloudflare_record.ns2_mitchty_net ]
  32. zone_id = var.cloudflare_mitchty_net_zoneid
  33. name = "*"
  34. value = linode_instance.prod.ip_address
  35. type = "A"
  36. ttl = local.dns_ttl
  37. }
  38. # resource "cloudflare_record" "root6_mitchty_net" {
  39. # depends_on = [
  40. # linode_instance.prod,
  41. # cloudflare_record.ns1_mitchty_net,
  42. # cloudflare_record.ns2_mitchty_net ]
  43. # zone_id = var.cloudflare_mitchty_net_zoneid
  44. # name = "@"
  45. # value = local.ipv6
  46. # type = "AAAA"
  47. # ttl = local.dns_ttl
  48. # }
  49. # resource "cloudflare_record" "splat6_mitchty_net" {
  50. # depends_on = [
  51. # linode_instance.prod,
  52. # cloudflare_record.ns1_mitchty_net,
  53. # cloudflare_record.ns2_mitchty_net ]
  54. # zone_id = var.cloudflare_mitchty_net_zoneid
  55. # name = "*"
  56. # value = local.ipv6
  57. # type = "AAAA"
  58. # ttl = local.dns_ttl
  59. # proxied = true
  60. # }
  61. resource "cloudflare_record" "home_mitchty_net" {
  62. depends_on = [
  63. cloudflare_record.root_mitchty_net,
  64. cloudflare_record.splat_mitchty_net ]
  65. zone_id = var.cloudflare_mitchty_net_zoneid
  66. name = "home"
  67. value = "24.118.92.50"
  68. type = "A"
  69. ttl = local.dns_ttl
  70. }
  71. resource "cloudflare_record" "www_mitchty_net" {
  72. depends_on = [
  73. cloudflare_record.root_mitchty_net,
  74. cloudflare_record.splat_mitchty_net ]
  75. zone_id = var.cloudflare_mitchty_net_zoneid
  76. name = "www"
  77. value = "mitchty.net"
  78. type = "CNAME"
  79. ttl = local.dns_ttl
  80. }
  81. resource "cloudflare_record" "git_mitchty_net" {
  82. depends_on = [
  83. cloudflare_record.root_mitchty_net,
  84. cloudflare_record.splat_mitchty_net ]
  85. zone_id = var.cloudflare_mitchty_net_zoneid
  86. name = "git"
  87. value = "mitchty.net"
  88. type = "CNAME"
  89. ttl = local.dns_ttl
  90. }
  91. # MX record setup for fastmail dkim/spf on root and all subdomains
  92. resource "cloudflare_record" "mx_cname_1_mitchty_net" {
  93. depends_on = [
  94. cloudflare_record.root_mitchty_net,
  95. cloudflare_record.splat_mitchty_net ]
  96. zone_id = var.cloudflare_mitchty_net_zoneid
  97. name = "fm1._domainkey"
  98. value = "fm1.mitchty.net.dkim.fmhosted.net"
  99. type = "CNAME"
  100. ttl = local.dns_ttl
  101. }
  102. resource "cloudflare_record" "mx_cname_2_mitchty_net" {
  103. depends_on = [
  104. cloudflare_record.root_mitchty_net,
  105. cloudflare_record.splat_mitchty_net ]
  106. zone_id = var.cloudflare_mitchty_net_zoneid
  107. name = "fm2._domainkey"
  108. value = "fm2.mitchty.net.dkim.fmhosted.net"
  109. type = "CNAME"
  110. ttl = local.dns_ttl
  111. }
  112. resource "cloudflare_record" "mx_cname_3_mitchty_net" {
  113. depends_on = [
  114. cloudflare_record.root_mitchty_net,
  115. cloudflare_record.splat_mitchty_net ]
  116. zone_id = var.cloudflare_mitchty_net_zoneid
  117. name = "fm3._domainkey"
  118. value = "fm3.mitchty.net.dkim.fmhosted.net"
  119. type = "CNAME"
  120. ttl = local.dns_ttl
  121. }
  122. resource "cloudflare_record" "mx_10_root_mitchty_net" {
  123. depends_on = [
  124. cloudflare_record.root_mitchty_net,
  125. cloudflare_record.splat_mitchty_net ]
  126. zone_id = var.cloudflare_mitchty_net_zoneid
  127. name = "@"
  128. value = "in1-smtp.messagingengine.com"
  129. type = "MX"
  130. priority = "10"
  131. ttl = local.dns_ttl
  132. }
  133. resource "cloudflare_record" "mx_20_root_mitchty_net" {
  134. depends_on = [
  135. cloudflare_record.root_mitchty_net,
  136. cloudflare_record.splat_mitchty_net ]
  137. zone_id = var.cloudflare_mitchty_net_zoneid
  138. name = "@"
  139. value = "in2-smtp.messagingengine.com"
  140. type = "MX"
  141. priority = "20"
  142. ttl = local.dns_ttl
  143. }
  144. resource "cloudflare_record" "mx_10_splat_mitchty_net" {
  145. depends_on = [
  146. cloudflare_record.root_mitchty_net,
  147. cloudflare_record.splat_mitchty_net ]
  148. zone_id = var.cloudflare_mitchty_net_zoneid
  149. name = "*"
  150. value = "in1-smtp.messagingengine.com"
  151. type = "MX"
  152. priority = "10"
  153. ttl = local.dns_ttl
  154. }
  155. resource "cloudflare_record" "mx_20_splat_mitchty_net" {
  156. depends_on = [
  157. cloudflare_record.root_mitchty_net,
  158. cloudflare_record.splat_mitchty_net ]
  159. zone_id = var.cloudflare_mitchty_net_zoneid
  160. name = "*"
  161. value = "in2-smtp.messagingengine.com"
  162. type = "MX"
  163. priority = "20"
  164. ttl = local.dns_ttl
  165. }
  166. resource "cloudflare_record" "txt_mx_root_mitchty_net" {
  167. depends_on = [
  168. cloudflare_record.root_mitchty_net,
  169. cloudflare_record.splat_mitchty_net ]
  170. zone_id = var.cloudflare_mitchty_net_zoneid
  171. name = "@"
  172. value = "v=spf1 include:spf.messagingengine.com ?all"
  173. type = "TXT"
  174. ttl = local.dns_ttl
  175. }
  176. resource "cloudflare_record" "txt_mx_splat_mitchty_net" {
  177. depends_on = [
  178. cloudflare_record.root_mitchty_net,
  179. cloudflare_record.splat_mitchty_net ]
  180. zone_id = var.cloudflare_mitchty_net_zoneid
  181. name = "*"
  182. value = "v=spf1 include:spf.messagingengine.com ?all"
  183. type = "TXT"
  184. ttl = local.dns_ttl
  185. }