Compare commits
5 Commits
main
...
8ca2011d77
| Author | SHA1 | Date | |
|---|---|---|---|
|
8ca2011d77
|
|||
|
c42a638a53
|
|||
|
f4e165921c
|
|||
|
fae0e13de0
|
|||
|
5697e53bc9
|
100
.gitignore
vendored
100
.gitignore
vendored
@@ -1,3 +1,45 @@
|
|||||||
|
# ---> Terraform
|
||||||
|
# Local .terraform directories
|
||||||
|
**/.terraform/*
|
||||||
|
|
||||||
|
# .tfstate files
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.*
|
||||||
|
|
||||||
|
# Crash log files
|
||||||
|
crash.log
|
||||||
|
crash.*.log
|
||||||
|
|
||||||
|
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
|
||||||
|
# password, private keys, and other secrets. These should not be part of version
|
||||||
|
# control as they are data points which are potentially sensitive and subject
|
||||||
|
# to change depending on the environment.
|
||||||
|
*.tfvars
|
||||||
|
*.tfvars.json
|
||||||
|
|
||||||
|
# Ignore override files as they are usually used to override resources locally and so
|
||||||
|
# are not checked in
|
||||||
|
override.tf
|
||||||
|
override.tf.json
|
||||||
|
*_override.tf
|
||||||
|
*_override.tf.json
|
||||||
|
|
||||||
|
# Ignore transient lock info files created by terraform apply
|
||||||
|
.terraform.tfstate.lock.info
|
||||||
|
|
||||||
|
# Include override files you do wish to add to version control using negated pattern
|
||||||
|
# !example_override.tf
|
||||||
|
|
||||||
|
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
||||||
|
# example: *tfplan*
|
||||||
|
|
||||||
|
# Ignore CLI configuration files
|
||||||
|
.terraformrc
|
||||||
|
terraform.rc
|
||||||
|
|
||||||
|
# ---> Ansible
|
||||||
|
*.retry
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
@@ -168,60 +210,8 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
# ---> Ansible
|
|
||||||
*.retry
|
|
||||||
|
|
||||||
# ---> Terraform
|
|
||||||
# Local .terraform directories
|
|
||||||
**/.terraform/*
|
|
||||||
|
|
||||||
# .tfstate files
|
|
||||||
*.tfstate
|
|
||||||
*.tfstate.*
|
|
||||||
|
|
||||||
# Crash log files
|
|
||||||
crash.log
|
|
||||||
crash.*.log
|
|
||||||
|
|
||||||
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
|
|
||||||
# password, private keys, and other secrets. These should not be part of version
|
|
||||||
# control as they are data points which are potentially sensitive and subject
|
|
||||||
# to change depending on the environment.
|
|
||||||
*.tfvars
|
|
||||||
*.tfvars.json
|
|
||||||
|
|
||||||
# Ignore override files as they are usually used to override resources locally and so
|
|
||||||
# are not checked in
|
|
||||||
override.tf
|
|
||||||
override.tf.json
|
|
||||||
*_override.tf
|
|
||||||
*_override.tf.json
|
|
||||||
|
|
||||||
# Ignore transient lock info files created by terraform apply
|
|
||||||
.terraform.tfstate.lock.info
|
|
||||||
|
|
||||||
# Include override files you do wish to add to version control using negated pattern
|
|
||||||
# !example_override.tf
|
|
||||||
|
|
||||||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
|
||||||
# example: *tfplan*
|
|
||||||
|
|
||||||
# Ignore CLI configuration files
|
|
||||||
.terraformrc
|
|
||||||
terraform.rc
|
|
||||||
|
|
||||||
# Custom ignores.
|
|
||||||
boot
|
|
||||||
ssh.pem
|
|
||||||
.DS_Store
|
|
||||||
*secret*
|
*secret*
|
||||||
*.tfbackend
|
|
||||||
*.env
|
|
||||||
*.tar.gz
|
|
||||||
*.tar.xz
|
|
||||||
*.tar
|
|
||||||
*.pem
|
|
||||||
.venv
|
|
||||||
.vscode
|
.vscode
|
||||||
tmp
|
.DS_Store
|
||||||
node_modules
|
*.key
|
||||||
|
*.out
|
||||||
18
Taskfile.yml
18
Taskfile.yml
@@ -1,15 +1,13 @@
|
|||||||
version: 3
|
version: 3
|
||||||
|
|
||||||
includes:
|
|
||||||
tf: { taskfile: terraform, dir: terraform }
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
deploy: ansible-playbook playbooks/deploy.yml
|
vault: ansible-vault edit vault.yml {{.CLI_ARGS}}
|
||||||
|
provision: ansible-playbook playbooks/provision.yml {{.CLI_ARGS}}
|
||||||
|
deploy: ansible-playbook playbooks/deploy.yml {{.CLI_ARGS}}
|
||||||
|
restore: ansible-playbook playbooks/restore.yml {{.CLI_ARGS}}
|
||||||
|
|
||||||
enter:
|
enter:
|
||||||
cmd: aws ssm start-session --target $INSTANCE_ID
|
cmd: ssh -i {{.KEY}} root@{{.IP}}
|
||||||
env:
|
vars:
|
||||||
INSTANCE_ID: { sh: jq -r .instance_id.value < config/infrastructure.secret.json }
|
KEY: { sh: ansible-vault view vault.yml | yq -r ".secret.private_ssh_key_path" }
|
||||||
AWS_REGION: { sh: jq -r .aws_region < config/ansible.secret.json }
|
IP: { sh: cat dist/terraform_outputs.yml | jq -r ".server_ip.value" }
|
||||||
AWS_ACCESS_KEY_ID: { sh: jq -r .aws_access_key < config/ansible.secret.json }
|
|
||||||
AWS_SECRET_ACCESS_KEY: { sh: jq -r .aws_secret_key < config/ansible.secret.json }
|
|
||||||
|
|||||||
13
ansible.cfg
Normal file
13
ansible.cfg
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[defaults]
|
||||||
|
callbacks_enabled = profile_tasks
|
||||||
|
localhost_warning = False
|
||||||
|
vault_password_file = vault.key
|
||||||
|
interpreter_python = /usr/bin/python3.11
|
||||||
|
|
||||||
|
[inventory]
|
||||||
|
inventory_unparsed_warning = False
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o IdentityAgent=none
|
||||||
|
pipelining = True
|
||||||
|
retries = 2
|
||||||
39
playbooks/provision.yml
Normal file
39
playbooks/provision.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
- name: Deploy terraform infrastructure.
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
vars_files:
|
||||||
|
- ../vault.yml
|
||||||
|
tasks:
|
||||||
|
- name: Reconfigure and plan.
|
||||||
|
community.general.terraform:
|
||||||
|
project_path: '../terraform'
|
||||||
|
state: "planned"
|
||||||
|
plan_file: plan.out
|
||||||
|
init_reconfigure: true
|
||||||
|
force_init: true
|
||||||
|
backend_config: "{{ terraform.backend }}"
|
||||||
|
variables: "{{ terraform.variables }}"
|
||||||
|
complex_vars: true
|
||||||
|
|
||||||
|
- name: Apply.
|
||||||
|
community.general.terraform:
|
||||||
|
project_path: '../terraform'
|
||||||
|
state: "present"
|
||||||
|
plan_file: plan.out
|
||||||
|
backend_config: "{{ terraform.backend }}"
|
||||||
|
variables: "{{ terraform.variables }}"
|
||||||
|
complex_vars: true
|
||||||
|
register: terraform_apply
|
||||||
|
|
||||||
|
- name: Create secret directory.
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: ../dist
|
||||||
|
recurse: true
|
||||||
|
mode: "0755"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Send outputs to file.
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ terraform_apply.outputs }}"
|
||||||
|
dest: ../dist/terraform_outputs.yml
|
||||||
|
mode: '0755'
|
||||||
@@ -2,7 +2,9 @@ ansible==11.1.0
|
|||||||
ansible-compat==24.10.0
|
ansible-compat==24.10.0
|
||||||
ansible-core==2.18.1
|
ansible-core==2.18.1
|
||||||
ansible-lint==24.12.2
|
ansible-lint==24.12.2
|
||||||
|
argcomplete==3.6.2
|
||||||
attrs==24.3.0
|
attrs==24.3.0
|
||||||
|
awscli-local==0.22.0
|
||||||
black==24.10.0
|
black==24.10.0
|
||||||
boto3==1.35.95
|
boto3==1.35.95
|
||||||
botocore==1.35.95
|
botocore==1.35.95
|
||||||
@@ -13,12 +15,14 @@ charset-normalizer==3.4.1
|
|||||||
click==8.1.8
|
click==8.1.8
|
||||||
cryptography==44.0.0
|
cryptography==44.0.0
|
||||||
filelock==3.16.1
|
filelock==3.16.1
|
||||||
|
go-task-bin==3.44.1
|
||||||
idna==3.10
|
idna==3.10
|
||||||
importlib_metadata==8.5.0
|
importlib_metadata==8.5.0
|
||||||
Jinja2==3.1.5
|
Jinja2==3.1.5
|
||||||
jmespath==1.0.1
|
jmespath==1.0.1
|
||||||
jsonschema==4.23.0
|
jsonschema==4.23.0
|
||||||
jsonschema-specifications==2024.10.1
|
jsonschema-specifications==2024.10.1
|
||||||
|
localstack-client==2.7
|
||||||
MarkupSafe==3.0.2
|
MarkupSafe==3.0.2
|
||||||
mypy-extensions==1.0.0
|
mypy-extensions==1.0.0
|
||||||
packaging==24.2
|
packaging==24.2
|
||||||
@@ -35,7 +39,10 @@ ruamel.yaml==0.18.10
|
|||||||
s3transfer==0.10.4
|
s3transfer==0.10.4
|
||||||
six==1.17.0
|
six==1.17.0
|
||||||
subprocess-tee==0.4.2
|
subprocess-tee==0.4.2
|
||||||
|
tomlkit==0.13.3
|
||||||
urllib3==2.3.0
|
urllib3==2.3.0
|
||||||
wcmatch==10.0
|
wcmatch==10.0
|
||||||
|
xmltodict==1.0.2
|
||||||
yamllint==1.35.1
|
yamllint==1.35.1
|
||||||
|
yq==3.4.3
|
||||||
zipp==3.21.0
|
zipp==3.21.0
|
||||||
|
|||||||
36
terraform/.terraform.lock.hcl
generated
36
terraform/.terraform.lock.hcl
generated
@@ -1,24 +1,24 @@
|
|||||||
# This file is maintained automatically by "terraform init".
|
# This file is maintained automatically by "terraform init".
|
||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/aws" {
|
provider "registry.terraform.io/hetznercloud/hcloud" {
|
||||||
version = "5.87.0"
|
version = "1.54.0"
|
||||||
|
constraints = "~> 1.45"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:IYq3by7O/eJuXzJwOF920z2nZEkw08PkDFdw2xkyhrs=",
|
"h1:EhA+n+6dzWKlBxyRabPUArCKseyCfAYlYFBB7Yt3TvI=",
|
||||||
"zh:017f237466875c919330b9e214fb33af14fffbff830d3755e8976d8fa3c963c2",
|
"zh:1b55c18929e6667fece7b6b462b9b298a09660e0d5173ef22fda780187e739c3",
|
||||||
"zh:0776d1e60aa93c85ecbb01144aed2789c8e180bb0f1c811a0aba17ca7247b26c",
|
"zh:1fbf44f714a213ca42e131d2cc257791701b1b788061fc720e7293f7853eb874",
|
||||||
"zh:0dfa5c6cfb3724494fdc73f7d042515e88a20da8968959f48b3ec0b937bd8c8f",
|
"zh:2392d902158dfa6a8ac4dc1f0435662bb2e2cc788464d71bcc66c6326ff2c390",
|
||||||
"zh:1707a5ead36a7980cb3f83e8b69a67a14ae725bfc990ddfcc209b59400b57b04",
|
"zh:2d5977b3ae947b341db17a0ff71ac9b6b9aa7ff4f1e84bf7cc1e428ccc42b77a",
|
||||||
"zh:1c71f54fdd6adcbe547d6577dbb843d72a30fef0ab882d0afbeb8a7b348bc442",
|
"zh:31c3a9ef4ffc4bd270f0418099a2027a13b3a48f5c585acb04363f89285fd348",
|
||||||
"zh:3563c850a29790957ec3f4d3ba203bfa2e084ac7319035b3f43b91f818a2c9b4",
|
"zh:34d3a40752fa9f18fac0c9b52ea65b363e3ca3dec040d36c461408d4a54548ee",
|
||||||
"zh:520bf6cef53785a92226651d5bebacbbf9314bdbc3211d0bf0903bce4e45149d",
|
"zh:61028bbd9f7787b89fc71304765089831e3ba8f9fcde130ab2b79c7f50fa0736",
|
||||||
"zh:56f9778575830f6e5c23462c2eccbf2c9afaddb00a69275fcfb33cd1a6d17f4d",
|
"zh:68fe4c68e3835aa096ba11e22eec73fbc05dc4dbc01e7e3fbccf9c4b9b78519c",
|
||||||
"zh:73e381cb0b1e76d471d7b0952f3d2a80350b507d15bda9b7041ea69077e3b5b5",
|
"zh:6a32dba16b3bda886682675ff4a1409ceaaff1dcaad35a2d063371d32490be54",
|
||||||
"zh:7da74b48f8fa088be758a92407980400cb4b039a8d9ba3c108907e4055e9ad6f",
|
"zh:7754f879a0026f4d2372885f89e4960a74f42e11c914d1ee4e8156c076549cd5",
|
||||||
"zh:8dacfa9623ba2e0197fe7db6faaaa0820a3b91fe00ba9e5d8a646340522bc8dd",
|
"zh:8f7d5bde3ec240fb8e7d33f26a4ab46ca26272ea494ce7ea3800f0928bc82b36",
|
||||||
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
|
"zh:aa4dd2e088be83be04ba9b8a839f45fed84e154c681599a4fa83ec09d9940f94",
|
||||||
"zh:9c2ebd21d697e1a611fe201788dc9e1678949a088afc85d4589563bca484d835",
|
"zh:bf931451103f9739c888bd980f9d7bdb3172f9247df41efb738667c4cef73840",
|
||||||
"zh:ac5d0bbf36f9a6cedbfb63993f6baf0aabdaf21c8d7fc3b1e69ba8cbf344b5f3",
|
"zh:f3873dcaeb70ab58aaa63d79dfbc19e2ec82607291912253f8cb76f46a074e66",
|
||||||
"zh:c2329644179f78a0458b6cf2dd5eaadca4c610fc3577a1b50620544d92df13e8",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
version: 3
|
|
||||||
silent: true
|
|
||||||
|
|
||||||
vars:
|
|
||||||
BACKEND: ../config/backend.secret.json
|
|
||||||
VARIABLES: ../config/variables.secret.json
|
|
||||||
OUTPUT: ../config/infrastructure.secret.json
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
init: terraform init -backend-config={{.BACKEND}}
|
|
||||||
plan: terraform plan -var-file={{.VARIABLES}}
|
|
||||||
destroy: terraform destroy
|
|
||||||
format: terraform fmt -recursive
|
|
||||||
out: terraform output -json > {{.OUTPUT}}
|
|
||||||
apply:
|
|
||||||
- terraform apply -var-file={{.VARIABLES}}
|
|
||||||
- task: out
|
|
||||||
import: terraform import -var-file={{.VARIABLES}} {{.CLI_ARGS}}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
rpm --rebuilddb
|
|
||||||
amazon-linux-extras install docker ansible2 python3.8 -y
|
|
||||||
|
|
||||||
# Make Docker work.
|
|
||||||
systemctl enable docker
|
|
||||||
systemctl start docker
|
|
||||||
|
|
||||||
# Set up the correct version of Python (for Ansible).
|
|
||||||
ln -sf /usr/bin/python3.8 /usr/bin/python3
|
|
||||||
ln -sf /usr/bin/pip3.8 /usr/bin/pip3
|
|
||||||
pip3 install botocore boto3 requests packaging
|
|
||||||
python3 -m pip install -U pip
|
|
||||||
|
|
||||||
# Add some swap space.
|
|
||||||
dd if=/dev/zero of=/swapfile bs=128M count=8
|
|
||||||
chmod 600 /swapfile
|
|
||||||
mkswap /swapfile
|
|
||||||
swapon /swapfile
|
|
||||||
|
|
||||||
# Stop SSH (because we have SSM.)
|
|
||||||
service sshd stop
|
|
||||||
|
|
||||||
# Install Docker Compose.
|
|
||||||
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
||||||
chmod +x /usr/local/bin/docker-compose
|
|
||||||
|
|
||||||
# ERROR: SSM User not created yet.
|
|
||||||
sudo usermod -aG docker ssm-user
|
|
||||||
@@ -1,65 +1,90 @@
|
|||||||
data "aws_vpc" "main" {
|
resource "hcloud_network" "network" {
|
||||||
tags = { Name = "Main" }
|
name = "proxy-network"
|
||||||
|
ip_range = local.network_cidr
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_subnet" "public" {
|
resource "hcloud_network_subnet" "subnet" {
|
||||||
tags = { SubnetOf = "Main", SubnetType = "Public" }
|
type = "cloud"
|
||||||
|
network_id = hcloud_network.network.id
|
||||||
|
network_zone = "eu-central"
|
||||||
|
ip_range = local.subnet_cidr
|
||||||
}
|
}
|
||||||
|
|
||||||
# An instance profile for access via AWS SSM.
|
/* -------------------------------------------------------------------------- */
|
||||||
data "aws_iam_instance_profile" "ssm" {
|
|
||||||
name = "SSMInstanceProfile"
|
resource "hcloud_primary_ip" "public_ip" {
|
||||||
|
name = "proxy-public-ip"
|
||||||
|
datacenter = local.datacenter
|
||||||
|
type = "ipv4"
|
||||||
|
assignee_type = "server"
|
||||||
|
auto_delete = false
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_security_group" "public" {
|
resource "hcloud_ssh_key" "ssh_key" {
|
||||||
tags = { GroupOf = "Main", GroupType = "Public" }
|
name = "proxy-ssh-key"
|
||||||
|
public_key = file(var.public_ssh_key_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_route_table" "public" {
|
resource "hcloud_server" "server_instance" {
|
||||||
tags = { TableOf = "Main", TableType = "Public" }
|
name = "proxy-server"
|
||||||
|
image = local.server_image
|
||||||
|
server_type = local.server_type
|
||||||
|
datacenter = local.datacenter
|
||||||
|
ssh_keys = [hcloud_ssh_key.ssh_key.id]
|
||||||
|
|
||||||
|
public_net {
|
||||||
|
ipv4_enabled = true
|
||||||
|
ipv4 = hcloud_primary_ip.public_ip.id
|
||||||
|
ipv6_enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
network {
|
||||||
|
network_id = hcloud_network.network.id
|
||||||
|
ip = local.proxy_ip
|
||||||
|
alias_ips = [ ]
|
||||||
|
}
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
hcloud_network_subnet.subnet,
|
||||||
|
hcloud_primary_ip.public_ip
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Give the private subnet full access to the internet, too.
|
resource "hcloud_firewall" "server_firewall" {
|
||||||
module "fck-nat" {
|
name = "proxy-server-firewall"
|
||||||
source = "RaJiska/fck-nat/aws"
|
|
||||||
|
|
||||||
name = "NatInstance"
|
# Allow ICMP.
|
||||||
vpc_id = data.aws_vpc.main.id
|
rule {
|
||||||
subnet_id = data.aws_subnet.public.id
|
direction = "in"
|
||||||
instance_type = "t4g.nano"
|
protocol = "icmp"
|
||||||
|
source_ips = ["0.0.0.0/0", "::/0"]
|
||||||
|
}
|
||||||
|
|
||||||
update_route_table = true
|
# Allow all out.
|
||||||
route_table_id = data.aws_route_table.public.id
|
rule {
|
||||||
|
direction = "out"
|
||||||
|
protocol = "tcp"
|
||||||
|
port = "any"
|
||||||
|
destination_ips = ["0.0.0.0/0", "::/0"]
|
||||||
|
}
|
||||||
|
|
||||||
tags = {
|
# Allow ingress for in-network.
|
||||||
Name = "Codebase: Nat"
|
rule {
|
||||||
|
direction = "in"
|
||||||
|
protocol = "tcp"
|
||||||
|
source_ips = [local.network_cidr]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Poke holes for SSH.
|
||||||
|
rule {
|
||||||
|
direction = "in"
|
||||||
|
protocol = "tcp"
|
||||||
|
port = "22"
|
||||||
|
source_ips = ["0.0.0.0/0", "::/0"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# An elastic IP, so if the reverse proxy is modified, the route tables won't.
|
resource "hcloud_firewall_attachment" "server_fw_attachment" {
|
||||||
resource "aws_eip" "public" {
|
firewall_id = hcloud_firewall.server_firewall.id
|
||||||
instance = aws_instance.proxy.id
|
server_ids = [hcloud_server.server_instance.id]
|
||||||
domain = "vpc"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# The reverse proxy.
|
|
||||||
resource "aws_instance" "proxy" {
|
|
||||||
ami = "ami-0adec96dc0cdc7bca"
|
|
||||||
instance_type = "t4g.nano"
|
|
||||||
subnet_id = data.aws_subnet.public.id
|
|
||||||
vpc_security_group_ids = [data.aws_security_group.public.id]
|
|
||||||
|
|
||||||
user_data = file("install.sh")
|
|
||||||
user_data_replace_on_change = true
|
|
||||||
|
|
||||||
iam_instance_profile = data.aws_iam_instance_profile.ssm.name
|
|
||||||
|
|
||||||
root_block_device {
|
|
||||||
volume_type = "gp3"
|
|
||||||
volume_size = 8
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = {
|
|
||||||
Name = "Codebase: Reverse Proxy"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
output "instance_id" {
|
|
||||||
value = aws_instance.proxy.id
|
|
||||||
description = "The instance ID of the Gitea instance."
|
|
||||||
}
|
|
||||||
5
terraform/outputs.tf
Normal file
5
terraform/outputs.tf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
output "proxy_ip" {
|
||||||
|
description = "The public address of the proxy server."
|
||||||
|
value = hcloud_server.server_instance.ipv4_address
|
||||||
|
sensitive = false
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
terraform {
|
|
||||||
# The backend is stored in an S3 bucket.
|
|
||||||
backend "s3" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Access AWS through the IaC roles.
|
|
||||||
provider "aws" {
|
|
||||||
region = var.aws_region
|
|
||||||
access_key = var.aws_access
|
|
||||||
secret_key = var.aws_secret
|
|
||||||
}
|
|
||||||
18
terraform/providers.tf
Normal file
18
terraform/providers.tf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
skip_credentials_validation = true
|
||||||
|
skip_region_validation = true
|
||||||
|
skip_requesting_account_id = true
|
||||||
|
}
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
hcloud = {
|
||||||
|
source = "hetznercloud/hcloud"
|
||||||
|
version = "~> 1.45"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "hcloud" {
|
||||||
|
token = var.hcloud_token
|
||||||
|
}
|
||||||
@@ -1,14 +1,25 @@
|
|||||||
variable "aws_region" {
|
locals {
|
||||||
type = string
|
datacenter = "fsn1-dc14"
|
||||||
description = "The AWS region things are created in."
|
server_type = "cx22"
|
||||||
|
server_image = "debian-12"
|
||||||
|
|
||||||
|
domain = "maximhutz.com"
|
||||||
|
subdomain = "git"
|
||||||
|
|
||||||
|
network_cidr = "10.10.0.0/16"
|
||||||
|
subnet_cidr = "10.10.0.0/24"
|
||||||
|
proxy_ip = "10.10.0.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_access" {
|
# ---------------------------------------------------------------------------- #
|
||||||
type = string
|
|
||||||
description = "The access key to generate the Gitea instance."
|
variable "hcloud_token" {
|
||||||
|
sensitive = true
|
||||||
|
description = "The hCloud token used to access Hetzner resources."
|
||||||
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "aws_secret" {
|
variable "public_ssh_key_path" {
|
||||||
type = string
|
description = "The location of the public key used to access the repository Gitea server."
|
||||||
description = "The access secret to generate the Gitea instance."
|
type = string
|
||||||
}
|
}
|
||||||
|
|||||||
30
vault.yml
Normal file
30
vault.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
34333538313033663865386437623137393162623332646635333033333131323735656639376432
|
||||||
|
3464336363356463613262363535306537643930646432650a316261313532613962663436346130
|
||||||
|
66613065343261313539613766333066643234356638346433326234303964356330366633656531
|
||||||
|
3435373363356264370a366637613463363931643761623130623136336536616139376330396230
|
||||||
|
34363664666439333937396537666338363531343965386336646538333464373663393233343334
|
||||||
|
61346130323335396331623535386631643061663762333061373635643961376535616631613438
|
||||||
|
61623163313136386530313465383764646238663635616666383235353265323036343864653733
|
||||||
|
63613961313532626532366363323733333233313034663431303934323736366637366265393237
|
||||||
|
36336238343563313136376366356631336636626236666630326436366533333363383664346262
|
||||||
|
37353434346362613162613465356537343830313030646665623436646334626435366366623634
|
||||||
|
37623232313934336661366364643266376166633238343361343738383331306636353764376439
|
||||||
|
32623962636463616336633862376635316364663362356633613839336236316331633531386561
|
||||||
|
33313637646161616634663039636337636635383866633961643637313661643338343463363037
|
||||||
|
38313636666435666563316233376465333534303732653061623763316237393463623437613430
|
||||||
|
64343233396665613032313936623538373031613266613534396530613534653331396437633261
|
||||||
|
32313938386431363433306334656539663461613539346330613837356166336134326434336436
|
||||||
|
30393665313230373966663263326433363765646164333035633035303831336136376137626334
|
||||||
|
33373066343732353064306133653939326535383531633233366332396662363138626162353334
|
||||||
|
38383632623238643831393332316135393336653063343330353839393935383736663531393966
|
||||||
|
33373430303035396238633037346430333138363038653665343531356439623165353831626161
|
||||||
|
30313666326366333636346434373034656432343238353061333166353834383562393532333565
|
||||||
|
35306631363330313432353232313234356233326261653938373863356237363961346134346237
|
||||||
|
64346237366530323234393732396430323930356635343431323831616264363263653532383537
|
||||||
|
63353635643334363131653637636666613037363438326132633833313964656163396638326466
|
||||||
|
39656632646639386161643764353362356333656466366263663939633863386330313931336363
|
||||||
|
36666631646134376264303565333665653264306338303065653838643133396333613033623366
|
||||||
|
61643730333439343365383333623434323535613562363435666138323165383939653832313262
|
||||||
|
36393936386566653738626666396363623737613533306466653639656664323032643631313961
|
||||||
|
6465
|
||||||
Reference in New Issue
Block a user