Skip to content

Commit

Permalink
Configure administration system
Browse files Browse the repository at this point in the history
  • Loading branch information
Taucher2003 committed Jul 13, 2024
1 parent e737ac5 commit 21619f9
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ default:
stage: terraform-apply
resource_group: tf/$TF_STATE_NAME
script:
- gitlab-terraform apply | tee output
- gitlab-terraform apply $TF_ARGS | tee output
- |
echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary"
grep "Apply complete!" output | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g"
Expand Down Expand Up @@ -81,6 +81,7 @@ tf-plan:server_administration:
variables:
TF_STATE_NAME: server_administration
TF_ROOT: 'envs/server_administration'
TF_ARGS: '-parallelism=1'

tf-apply:server_administration:
extends:
Expand Down
7 changes: 5 additions & 2 deletions envs/server_administration/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ provider "docker" {
cert_path = ""
}

resource "docker_network" "test" {
name = "test"
module "administration" {
source = "../../system/administration"

cloudflare_account_id = var.cloudflare_account_id
server_administration_ip = var.server_administration_ip
}
56 changes: 56 additions & 0 deletions system/administration/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "4.37.0"
}
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}

data "cloudflare_zone" "main_domain" {
account_id = var.cloudflare_account_id
name = "code0.tech"
}

module "proxy" {
source = "../../modules/docker/proxy"

certificate_hostnames = [
"plane.code0.tech",
]
}

module "plane" {
source = "../../modules/docker/plane"

web_url = "plane.code0.tech"
docker_proxy_network_id = module.proxy.docker_proxy_network_id
}

resource "cloudflare_record" "server_ip" {
name = "server_administration"
type = "A"
zone_id = data.cloudflare_zone.main_domain.id
value = var.server_administration_ip
proxied = true

comment = "Managed by Terraform"
}

resource "cloudflare_record" "server_cname" {
for_each = toset([
"plane"
])

name = each.value
type = "CNAME"
zone_id = data.cloudflare_zone.main_domain.id
value = cloudflare_record.server_ip.hostname
proxied = true

comment = "Managed by Terraform"
}
9 changes: 9 additions & 0 deletions system/administration/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "cloudflare_account_id" {
type = string
sensitive = true
}

variable "server_administration_ip" {
type = string
sensitive = true
}

0 comments on commit 21619f9

Please sign in to comment.