Updates to dns management. Add .env.dit and .htaccess.

This commit is contained in:
Otho 2024-02-24 00:35:11 -05:00
parent bf80733b1f
commit b02fa230ec
Signed by: Otho
GPG Key ID: 16C720CD3BBE21D9
4 changed files with 31 additions and 29 deletions

1
.env.dist Symbolic link
View File

@ -0,0 +1 @@
../.env.dist

1
.htaccess Normal file
View File

@ -0,0 +1 @@
Require all denied

View File

@ -82,10 +82,19 @@ tasks:
vars: vars:
remote_path: "{{.ITEM}}" remote_path: "{{.ITEM}}"
plan: source .env; terraform init; terraform plan # Terraform
migrate-state: terraform init -migrate-state plan:
- task: tf
vars:
CLI_ARGS: plan
apply:
- task: tf
vars:
CLI_ARGS: apply
tf: source .env; terraform init; terraform {{.CLI_ARGS}}
# Utilities # Utilities
printenv: source .env; printenv
path-update: echo scp "{{.local_path}}" "$stashbox_domain:{{.remote_path}}" path-update: echo scp "{{.local_path}}" "$stashbox_domain:{{.remote_path}}"
path-backup: scp "$stashbox_domain:{{.remote_path}}" "./.$(basename {{.remote_path}})-$(date +%s)" || echo "No file found." path-backup: scp "$stashbox_domain:{{.remote_path}}" "./.$(basename {{.remote_path}})-$(date +%s)" || echo "No file found."
path-diff: path-diff:

45
dns.tf
View File

@ -10,71 +10,62 @@ terraform {
provider "namecheap" {} provider "namecheap" {}
variable "stash_domain" { variable "stashbox_domain" {
type = string type = string
default = "web.stash" default = "web.stash"
} }
variable "web_addr" { variable "stashbox_web_addr" {
type = string type = string
default = "::db" default = "::db"
} }
variable "feed_addr" { variable "stashbox_feed_addr" {
type = string type = string
default = "::feed" default = "::feed"
} }
variable "app_addr" { variable "stashbox_ip4_ext" {
type = string
default = "::beef"
}
variable "ip4_ext" {
type = string type = string
default = "0.0.0.0" default = "0.0.0.0"
} }
resource "namecheap_domain_records" "stash" { resource "namecheap_domain_records" "stashbox" {
domain = var.stash_domain domain = var.stashbox_domain
record { record {
hostname = "www" hostname = "www"
address = var.web_addr address = var.stashbox_web_addr
type = "AAAA" type = "AAAA"
ttl = 1799
} }
record { record {
hostname = "www" hostname = "www"
address = var.ip4_ext address = var.stashbox_ip4_ext
type = "A" type = "A"
ttl = 1799
} }
record { record {
hostname = "feed" hostname = "feed"
address = var.feed_addr address = var.stashbox_feed_addr
type = "AAAA" type = "AAAA"
ttl = 1799
} }
record { record {
hostname = "feed" hostname = "feed"
address = var.ip4_ext address = var.stashbox_ip4_ext
type = "A"
}
record {
hostname = "app"
address = var.app_addr
type = "AAAA"
}
record {
hostname = "app"
address = var.ip4_ext
type = "A" type = "A"
ttl = 1799
} }
record { record {
hostname = "@" hostname = "@"
address = "www.${var.stash_domain}" address = "www.${var.stashbox_domain}."
type = "CNAME" type = "CNAME"
ttl = 1799
} }
record { record {
hostname = "plex" hostname = "plex"
address = "feed.${var.stash_domain}" address = "feed.${var.stashbox_domain}."
type = "CNAME" type = "CNAME"
ttl = 1799
} }
} }