initial commit
This commit is contained in:
24
haproxy/.terraform.lock.hcl
generated
Normal file
24
haproxy/.terraform.lock.hcl
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/sepehrimanian/haproxy" {
|
||||
version = "0.0.7"
|
||||
hashes = [
|
||||
"h1:o/0hi5No8Bs2ph5fEDoZXVTb3iPOy+o5FJMag85hrF0=",
|
||||
"zh:27de01566ffe8bcab684fec9d9c5cca8eb3a8d6f3067e486f4a3dc989ac34e91",
|
||||
"zh:31037353d5c83068ccad37bc87fe9fe033d82f3b580d7657a7145c5174bddf4d",
|
||||
"zh:44bcd7edd8a88ddfc3db123818580fbc0804fa2d27e296624c0c3ef7a3f64320",
|
||||
"zh:514ccac64b019167c324f4fd067b14ffeb657975c011c942cfd788af3ce47718",
|
||||
"zh:6fb93731af08bf1f51b49995650088a1be42c0a27d3d50c893fe3f26b1abace8",
|
||||
"zh:75bd809ab395e89961e2c7fa296ada101b6d00137ca348bb49f1e68b93b66662",
|
||||
"zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f",
|
||||
"zh:89c1869e447f5cb6bba643614a883a0f77a044e4fa517c9736d027b3f6c18e4a",
|
||||
"zh:89d435b3749051cbcb1b582e83aae38c245fc2df0fa7449c1054c9611dd1318f",
|
||||
"zh:94535d4d2e74610924b6acd5a03882b48093469ea5ef45193f9dbcbfdec7e255",
|
||||
"zh:9dbe38c5b503e2c520427fd3608e10b91c342f96ef4bf76241cabd6a5f9006e1",
|
||||
"zh:cd407fe7d6cf9e96e3962742757c9cb0f813e551856360c3ad5397984689865c",
|
||||
"zh:e328fd431719f65f8d2bdb0ba720abb6fb50d08abf1d694fcde23ab7bcc17fd8",
|
||||
"zh:f22f75dbe2667c85d3a49d54b0d4160a71151326e09327140e1eb9da953cf31d",
|
||||
"zh:fd9d13134da972dfa8d8728294fada24c40704bfadec99d257e3d882ce5c00bb",
|
||||
]
|
||||
}
|
||||
18
haproxy/backend.sh
Normal file
18
haproxy/backend.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
curl -X POST \
|
||||
--user admin:adminpwd \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"name": "lololo",
|
||||
"mode": "http",
|
||||
"balance": {
|
||||
"algorithm": "roundrobin"
|
||||
},
|
||||
"default_server": {
|
||||
"alpn": "h2",
|
||||
"check": "enabled",
|
||||
"check_alpn": "h2",
|
||||
"maxconn": 30,
|
||||
"weight": 100
|
||||
}
|
||||
}' \
|
||||
"http://192.168.0.200:8080/v3/services/haproxy/configuration/backends?version=$CFGVER"
|
||||
44
haproxy/frontend.tf
Normal file
44
haproxy/frontend.tf
Normal file
@@ -0,0 +1,44 @@
|
||||
resource "haproxy_backend" "backend_tf_test" {
|
||||
name = "backend_tf_test"
|
||||
mode = "http"
|
||||
|
||||
balance {
|
||||
algorithm = "roundrobin"
|
||||
}
|
||||
|
||||
httpchk_params {
|
||||
uri = "/health"
|
||||
version = "HTTP/1.1"
|
||||
method = "GET"
|
||||
}
|
||||
|
||||
forwardfor {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "haproxy_frontend" "front_tf_test" {
|
||||
name = "front_tf_test"
|
||||
backend = haproxy_backend.backend_tf_test.name
|
||||
mode = "http"
|
||||
|
||||
compression {
|
||||
algorithms = ["gzip", "identity"]
|
||||
offload = true
|
||||
types = ["text/html", "text/plain", "text/css", "application/javascript"]
|
||||
}
|
||||
|
||||
forwardfor {
|
||||
enabled = true
|
||||
header = "X-Forwarded-For"
|
||||
ifnone = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "haproxy_bind" "bind_tf_test" {
|
||||
name = "bind_test"
|
||||
port = 8888
|
||||
address = "0.0.0.0"
|
||||
parent_name = haproxy_frontend.front_tf_test.name
|
||||
parent_type = "frontend"
|
||||
}
|
||||
13
haproxy/provider.tf
Normal file
13
haproxy/provider.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
haproxy = {
|
||||
source = "SepehrImanian/haproxy"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "haproxy" {
|
||||
url = "http://192.168.0.130:8080"
|
||||
username = "admin"
|
||||
password = "adminpwd"
|
||||
}
|
||||
Reference in New Issue
Block a user