first commit
This commit is contained in:
45
environments/network/main.tf
Normal file
45
environments/network/main.tf
Normal file
@@ -0,0 +1,45 @@
|
||||
// Network environment
|
||||
// Contains configurations for network infrastructure
|
||||
|
||||
locals {
|
||||
module_dir = "../../modules"
|
||||
}
|
||||
|
||||
module "cloudflare_globals" {
|
||||
source = "${local.module_dir}/00-globals/cloudflare"
|
||||
|
||||
cloudflare_api_token = var.cloudflare_api_token
|
||||
cloudflare_account_id = var.cloudflare_account_id
|
||||
cloudflare_zone_id = var.cloudflare_zone_id
|
||||
domain = var.domain
|
||||
}
|
||||
|
||||
module "homelab_docker_network" {
|
||||
source = "${local.module_dir}/01-networking/docker-network"
|
||||
|
||||
name = "homelab-network"
|
||||
driver = "bridge"
|
||||
attachable = true
|
||||
subnet = "10.100.0.0/16"
|
||||
}
|
||||
|
||||
module "homelab_cloudflared_tunnel" {
|
||||
source = "${local.module_dir}/01-networking/cloudflared-tunnel"
|
||||
|
||||
cloudflare_account_id = module.cloudflare_globals.cloudflare_account_id
|
||||
cloudflare_zone_id = module.cloudflare_globals.cloudflare_zone_id
|
||||
|
||||
tunnel_name = "homelab"
|
||||
container_name = "cloudflared-homelab"
|
||||
|
||||
ingress_rules = [
|
||||
{
|
||||
hostname = "budget.${var.domain}"
|
||||
service = "http://actualbudget:5006"
|
||||
},
|
||||
]
|
||||
|
||||
networks = [module.homelab_docker_network.name]
|
||||
|
||||
monitoring = true
|
||||
}
|
||||
36
environments/network/outputs.tf
Normal file
36
environments/network/outputs.tf
Normal file
@@ -0,0 +1,36 @@
|
||||
output "cloudflare_account_id" {
|
||||
description = "Cloudflare account ID"
|
||||
value = module.cloudflare_globals.cloudflare_account_id
|
||||
}
|
||||
|
||||
output "cloudflare_zone_id" {
|
||||
description = "Cloudflare zone ID"
|
||||
value = module.cloudflare_globals.cloudflare_zone_id
|
||||
}
|
||||
|
||||
output "domain" {
|
||||
description = "Base domain name"
|
||||
value = module.cloudflare_globals.domain
|
||||
}
|
||||
|
||||
// Docker network outputs
|
||||
output "homelab_docker_network_name" {
|
||||
description = "Name of the Docker network"
|
||||
value = module.homelab_docker_network.name
|
||||
}
|
||||
|
||||
// Tunnel outputs
|
||||
output "homelab_cloudflared_tunnel_id" {
|
||||
description = "ID of the Cloudflare tunnel"
|
||||
value = module.homelab_cloudflared_tunnel.tunnel_id
|
||||
}
|
||||
|
||||
output "homelab_cloudflared_tunnel_name" {
|
||||
description = "Name of the Cloudflare tunnel"
|
||||
value = module.homelab_cloudflared_tunnel.tunnel_name
|
||||
}
|
||||
|
||||
output "homelab_cloudflared_tunnel_cname_target" {
|
||||
description = "CNAME target for the tunnel"
|
||||
value = module.homelab_cloudflared_tunnel.cname_target
|
||||
}
|
||||
21
environments/network/variables.tf
Normal file
21
environments/network/variables.tf
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
variable "cloudflare_api_token" {
|
||||
description = "API token for Cloudflare with the necessary permissions"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "cloudflare_account_id" {
|
||||
description = "Cloudflare account ID"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "cloudflare_zone_id" {
|
||||
description = "Cloudflare zone ID for the domain"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
description = "Base domain name (e.g., example.com)"
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user