diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2fbd761 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.io +*.hcl +*.backup +*.tfstate +.terraform \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..0be292d --- /dev/null +++ b/main.tf @@ -0,0 +1,71 @@ +terraform { + required_providers { + proxmox = { + source = "bpg/proxmox" + version = ">= 0.50.0" + } + } +} + + +provider "proxmox" { + endpoint = "https://192.168.0.166:8006" + api_token = var.proxmox_api_token + insecure = true +} + + +resource "proxmox_virtual_environment_container" "jenkins" { + description = "Managed by Terraform" + + start_on_boot = "true" + + cpu { + cores = 2 + } + + memory { + dedicated = 2048 + } + + disk { + datastore_id = "local-lvm" + size = 15 + } + + + initialization { + dns { + servers = ["192.168.0.181"] + } + + hostname = "jenkins" + + ip_config { + ipv4 { + address = "dhcp" + } + } + + } + + network_interface { + name = "eth0" + } + + node_name = "homestrg1" + + operating_system { + template_file_id = "local:vztmpl/ubuntu-24.10-standard_24.10-1_amd64.tar.zst" + type = "ubuntu" + } + + tags = [ + "linux", + "ubuntu" + ] + + startup { + order = "3" + } +} \ No newline at end of file diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..cbb95c5 --- /dev/null +++ b/variables.tf @@ -0,0 +1,17 @@ +variable "proxmox_api_token" { + description = "API token for Proxmox" + type = string + sensitive = true +} + +variable "virtual_environment_storage" { + description = "Name of the Proxmox storage" + type = string + default = "local-lvm" +} + +variable "release_20250610_ubuntu_24_noble_lxc_img_url" { + type = string + description = "The URL for the Ubuntu 24.04 LXC image" + default = "https://mirrors.servercentral.com/ubuntu-cloud-images/releases/24.04/release-20250610/ubuntu-24.04-server-cloudimg-amd64-root.tar.xz" +} \ No newline at end of file