diff --git a/.drone.yml b/.drone.yml index 32f7bf5..af705b0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,8 +39,8 @@ steps: image: hashicorp/terraform:1.5 commands: - terraform -chdir=infrastructure validate - - terraform -chdir=infrastructure plan - - terraform -chdir=infrastructure apply + - terraform -chdir=infrastructure plan -out tfapply + - terraform -chdir=infrastructure apply -auto-approve tfapply environment: TF_VAR_virtual_environment_endpoint: from_secret: virtual_environment_endpoint @@ -82,8 +82,8 @@ steps: image: hashicorp/terraform:1.5 commands: - terraform -chdir=infrastructure validate - - terraform -chdir=infrastructure plan - - terraform -chdir=infrastructure apply + - terraform -chdir=infrastructure plan -out tfapply + - terraform -chdir=infrastructure apply -auto-approve tfapply environment: TF_VAR_virtual_environment_endpoint: from_secret: virtual_environment_endpoint diff --git a/.gitignore b/.gitignore index bcec853..23e8b57 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ *.tfstate *.tfstate.* +tfapply + # Crash log files crash.log crash.*.log diff --git a/infrastructure/infra.tf b/infrastructure/infra.tf new file mode 100644 index 0000000..6a737d7 --- /dev/null +++ b/infrastructure/infra.tf @@ -0,0 +1,95 @@ +# proxmox_virtual_environment_vm.devops: +resource "proxmox_virtual_environment_vm" "infra" { + acpi = true + vm_id = "113" + machine = "q35" + name = "infra" + node_name = "proxmox" + scsi_hardware = "virtio-scsi-pci" + started = true + tablet_device = false + tags = [] + template = false + + clone { + vm_id = 9999 + } + + agent { + enabled = true + timeout = "15m" + trim = false + type = "virtio" + } + + cpu { + cores = 2 + flags = [] + hotplugged = 0 + numa = false + sockets = 1 + type = "host" + units = 1024 + + } + + disk { + datastore_id = "local" + size = 30 + ssd = true + iothread = true + interface = "scsi0" + } + + initialization { + datastore_id = "local" + interface = "ide2" + + ip_config { + ipv4 { + address = "dhcp" + } + ipv6 { + address = "auto" + } + } + + user_account { + keys = var.virtual_environment_sshkeys + username = "tim" + password = random_password.devops_vm_password.result + } + } + + memory { + dedicated = 4096 + floating = 0 + shared = 0 + } + + network_device { + bridge = "vmbr0" + enabled = true + firewall = false + model = "virtio" + mtu = 0 + rate_limit = 0 + vlan_id = 0 + } + + vga { + enabled = true + memory = 16 + type = "std" + } +} +resource "random_password" "infra_vm_password" { + length = 16 + override_special = "_%@" + special = true +} + +output "infra_vm_password" { + value = random_password.devops_vm_password.result + sensitive = true +} \ No newline at end of file