first commit

This commit is contained in:
2026-04-02 11:32:20 -05:00
commit 05426c2940
6 changed files with 159 additions and 0 deletions

40
.gitignore vendored Normal file
View File

@@ -0,0 +1,40 @@
# Created by https://www.toptal.com/developers/gitignore/api/terraform
# Edit at https://www.toptal.com/developers/gitignore?templates=terraform
### 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
# 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
# End of https://www.toptal.com/developers/gitignore/api/terraform

0
README.md Normal file
View File

View File

@@ -0,0 +1,19 @@
# Hetzner Token
hcloud_token = "VNC...."
# SSH Config
hcloud_ssh_key_name = "ssh...."
hcloud_ssh_key_file_path = "~/.ssh/id_rsa.pub"
# Server Config
hcloud_server_name = "web...."
hcloud_server_image = "ubuntu-24.04"
hcloud_server_type = "cx23"
# Server Volume Name
hcloud_volume_name = "volume..."
hcloud_volume_size = 10

22
terraform/.terraform.lock.hcl generated Normal file
View File

@@ -0,0 +1,22 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hetznercloud/hcloud" {
version = "1.60.1"
hashes = [
"h1:aFTtCV6KIyK8QpkQrJZfAyjx+GXNVaBm4qN3Vvqmwlc=",
"zh:0a746671e3f149b998a2abf730a5401a07305c67f93d5bbfdcf60aa19fdebb4d",
"zh:156273b900a006253841727387671dd67c7c5c502998d6a9af5a5abbf5717fdf",
"zh:2daa1290c50c081bb6a6cfa76b2872ea9fd9658eb3f2e81deab58b1ee48cf348",
"zh:36d6dac96ac6389f35bb1f19f40c4263bf78fa36fa7468971cf646c69eeae663",
"zh:5d0040a11470ced3eddf7d3e8e823982f80f8eb127cf285cd351bfc26a4d1108",
"zh:60ac7d3d948d7280a6e53088d5c41c444712f05e4274e37b0f4a81da9dcd1edb",
"zh:9fe5dd114ebb6f8da0dc9b5485c42d01cd41ed61a6fe2fc92bb3038fe4d708ea",
"zh:ae755ea4faca6ee410a397702a2c74f10ea28ec1ab95e1656be7a6f5908d1d23",
"zh:b3edcf6ea0f6498bcbdcbac8ec69dfb79278c64c7ea46c3050cd361a603302b0",
"zh:c6059fad0c4d2ecc3475c1767779a8e8adfcb1168101aae57ba7783510a24ae2",
"zh:dfdeb297e97d5b97b04d16ded3f8ef6779fc22cbd0322a16aeff3b5feee36fe2",
"zh:e38d04e7a5d0dbc3858eaa678167b6ec5e73035dae3479c7a61e6d971e58c765",
"zh:fd60acd9f16b4eb7b442a557d19294a89f6a8a05f7ca57f4aa689a2a554e74bd",
]
}

24
terraform/hcloud.tf Normal file
View File

@@ -0,0 +1,24 @@
provider "hcloud" {
token = var.hcloud_token
}
resource "hcloud_ssh_key" "default" {
name = var.hcloud_ssh_key_name
public_key = file(var.hcloud_ssh_key_file_path)
}
resource "hcloud_server" "web" {
name = var.hcloud_server_name
image = var.hcloud_server_image
server_type = var.hcloud_server_type
ssh_keys = [hcloud_ssh_key.default.id]
}
resource "hcloud_volume" "storage" {
name = var.hcloud_volume_name
size = var.hcloud_volume_size
server_id = hcloud_server.web.id
automount = true
format = "ext4"
}

54
terraform/variables.tf Normal file
View File

@@ -0,0 +1,54 @@
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
}
}
required_version = ">= 0.13"
}
variable "hcloud_token" {
sensitive = true
}
variable "hcloud_ssh_key_name" {
description = "Nombre de la clave SSH en Hetzner"
type = string
default = "default-ssh-key"
}
variable "hcloud_ssh_key_file_path" {
description = "Ruta al archivo de clave SSH pública"
type = string
default = "~/.ssh/id_rsa.pub"
}
variable "hcloud_server_name" {
description = "Server Name"
type = string
default = "app"
}
variable "hcloud_server_image" {
description = "Image Name"
type = string
default = "ubuntu-24.04"
}
variable "hcloud_server_type" {
description = "Server Type"
type = string
default = "cx23"
}
variable "hcloud_volume_name" {
description = "Server Volume Name"
type = string
default = "web_volume"
}
variable "hcloud_volume_size" {
description = "Server Volume Name"
type = number
default = 10
}