Skip to content

Commit

Permalink
create from clone, new provider version
Browse files Browse the repository at this point in the history
  • Loading branch information
florianBachinger committed Oct 28, 2024
1 parent 6c20406 commit 4658d79
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
kubernetes/terraform/secrets_filled.txt
kubernetes/terraform/.terraform
kubernetes/terraform/.terraform.lock.hcl
kubernetes/terraform/terraform.tfstate
kubernetes/terraform/terraform.tfstate.backup
8 changes: 4 additions & 4 deletions kubernetes/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "0.59.1"
version = "0.66.3"
}
}
}
Expand All @@ -15,6 +15,6 @@ provider "proxmox" {
insecure = true
}

terraform {
backend "local" { path = "/home/spainfra/terraform_state/kubernetes_cluster/terraform.tfstate" }
}
# terraform {
# backend "local" { path = "/home/spainfra/terraform_state/kubernetes_cluster/terraform.tfstate" }
# }
30 changes: 23 additions & 7 deletions kubernetes/terraform/vm_cloud_image.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
resource "proxmox_virtual_environment_download_file" "CentOS_cloud_image" {
content_type = "iso"
datastore_id = "local"
node_name = var.node_name
url = "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-latest.x86_64.qcow2"
file_name = "CentOS8-genericcloud_managed_by_spa_terraform_runner_do_not_delete.img"
}
# resource "proxmox_virtual_environment_download_file" "cloud_image" {
# content_type = "iso"
# datastore_id = "local"
# node_name = var.node_name
# url = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img"
# file_name = "Ubuntu_noble-server-cloudimg_managed_by_spa_terraform_runner_do_not_delete.img"
# }

# resource "proxmox_virtual_environment_download_file" "cloud_image" {
# content_type = "iso"
# datastore_id = "local"
# node_name = var.node_name
# url = "https://cdimage.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2"
# file_name = "debian-12-cloudimg_managed_by_spa_terraform_runner_do_not_delete.img"
# }

# resource "proxmox_virtual_environment_download_file" "cloud_image" {
# content_type = "iso"
# datastore_id = "local"
# node_name = var.node_name
# url = "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-latest.x86_64.qcow2"
# file_name = "CentOS-9-cloudimg_managed_by_spa_terraform_runner_do_not_delete.img"
# }
13 changes: 8 additions & 5 deletions kubernetes/terraform/vm_control_planes.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "proxmox_virtual_environment_vm" "k8s_cp" {
count = var.number_of_control_planes

name = "k8s-cp-${count.index}"
name = "k8s-cp-${count.index + 1}"
description = "Managed by Terraform"
tags = ["terraform"]
node_name = var.node_name
Expand All @@ -23,12 +23,15 @@ resource "proxmox_virtual_environment_vm" "k8s_cp" {
vlan_id = var.vlan_id
}

clone {
vm_id = 100
retries = 10
}

disk {
datastore_id = "dellsan"
file_id = proxmox_virtual_environment_download_file.CentOS_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
# file_id = proxmox_virtual_environment_download_file.cloud_image.id
interface = "ide0"
size = 40
}

Expand Down
13 changes: 8 additions & 5 deletions kubernetes/terraform/vm_large_worker.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "proxmox_virtual_environment_vm" "k8s_worker_large" {
count = var.number_of_large_workers

name = "k8s-worker-large-${count.index}"
name = "k8s-worker-large-${count.index + 1}"
description = "Managed by Terraform"
tags = ["terraform"]
node_name = var.node_name
Expand All @@ -23,12 +23,15 @@ resource "proxmox_virtual_environment_vm" "k8s_worker_large" {
vlan_id = var.vlan_id
}

clone {
vm_id = 107
retries = 10
}

disk {
datastore_id = "dellsan"
file_id = proxmox_virtual_environment_download_file.CentOS_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
# file_id = proxmox_virtual_environment_download_file.cloud_image.id
interface = "ide0"
size = 40
}

Expand Down
13 changes: 8 additions & 5 deletions kubernetes/terraform/vm_medium_worker.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "proxmox_virtual_environment_vm" "k8s_worker_medium" {
count = var.number_of_medium_workers

name = "k8s-worker-medium-${count.index}"
name = "k8s-worker-medium-${count.index + 1}"
description = "Managed by Terraform"
tags = ["terraform"]
node_name = var.node_name
Expand All @@ -23,12 +23,15 @@ resource "proxmox_virtual_environment_vm" "k8s_worker_medium" {
vlan_id = var.vlan_id
}

clone {
vm_id = 109
retries = 10
}

disk {
datastore_id = "dellsan"
file_id = proxmox_virtual_environment_download_file.CentOS_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
# file_id = proxmox_virtual_environment_download_file.cloud_image.id
interface = "ide0"
size = 40
}

Expand Down
13 changes: 8 additions & 5 deletions kubernetes/terraform/vm_small_worker.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "proxmox_virtual_environment_vm" "k8s_worker_small" {
count = var.number_of_small_workers

name = "k8s-worker-small-${count.index}"
name = "k8s-worker-small-${count.index + 1}"
description = "Managed by Terraform"
tags = ["terraform"]
node_name = var.node_name
Expand All @@ -23,12 +23,15 @@ resource "proxmox_virtual_environment_vm" "k8s_worker_small" {
vlan_id = var.vlan_id
}

clone {
vm_id = 104
retries = 10
}

disk {
datastore_id = "dellsan"
file_id = proxmox_virtual_environment_download_file.CentOS_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
# file_id = proxmox_virtual_environment_download_file.cloud_image.id
interface = "ide0"
size = 40
}

Expand Down

0 comments on commit 4658d79

Please sign in to comment.