update
This commit is contained in:
@@ -36,10 +36,6 @@ kind: ProviderConfig
|
|||||||
metadata:
|
metadata:
|
||||||
name: default
|
name: default
|
||||||
spec:
|
spec:
|
||||||
# Note that unlike most provider configs this one supports an array of
|
|
||||||
# credentials. This is because each tofu workspace uses a single
|
|
||||||
# Crossplane provider config, but could use multiple Terraform providers each
|
|
||||||
# with their own credentials.
|
|
||||||
#credentials:
|
#credentials:
|
||||||
# - filename: gcp-credentials.json
|
# - filename: gcp-credentials.json
|
||||||
# source: Secret
|
# source: Secret
|
||||||
@@ -47,9 +43,6 @@ spec:
|
|||||||
# namespace: upbound-system
|
# namespace: upbound-system
|
||||||
# name: opentofu-gcp-creds
|
# name: opentofu-gcp-creds
|
||||||
# key: credentials
|
# key: credentials
|
||||||
# This optional configuration block can be used to inject HCL into any
|
|
||||||
# workspace that uses this provider config, for example to setup Terraform
|
|
||||||
# providers.
|
|
||||||
configuration: |
|
configuration: |
|
||||||
|
|
||||||
// Modules _must_ use remote state. The provider does not persist state.
|
// Modules _must_ use remote state. The provider does not persist state.
|
||||||
@@ -68,134 +61,134 @@ spec:
|
|||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: opentofu.upbound.io/v1beta1
|
#apiVersion: opentofu.upbound.io/v1beta1
|
||||||
kind: Workspace
|
#kind: Workspace
|
||||||
metadata:
|
#metadata:
|
||||||
name: test-vm
|
# name: test-vm
|
||||||
annotations:
|
# annotations:
|
||||||
crossplane.io/external-name: test
|
# crossplane.io/external-name: test
|
||||||
spec:
|
#spec:
|
||||||
forProvider:
|
# forProvider:
|
||||||
source: Inline
|
# source: Inline
|
||||||
env:
|
# env:
|
||||||
- name: TF_VAR_pm_api_url
|
# - name: TF_VAR_pm_api_url
|
||||||
secretKeyRef:
|
# secretKeyRef:
|
||||||
namespace: crossplane
|
# namespace: crossplane
|
||||||
name: proxmox-secret
|
# name: proxmox-secret
|
||||||
key: pm_api_url
|
# key: pm_api_url
|
||||||
- name: TF_VAR_pm_password
|
# - name: TF_VAR_pm_password
|
||||||
secretKeyRef:
|
# secretKeyRef:
|
||||||
namespace: crossplane
|
# namespace: crossplane
|
||||||
name: proxmox-secret
|
# name: proxmox-secret
|
||||||
key: pm_password
|
# key: pm_password
|
||||||
- name: TF_VAR_pm_user
|
# - name: TF_VAR_pm_user
|
||||||
secretKeyRef:
|
# secretKeyRef:
|
||||||
namespace: crossplane
|
# namespace: crossplane
|
||||||
name: proxmox-secret
|
# name: proxmox-secret
|
||||||
key: pm_user
|
# key: pm_user
|
||||||
module: |
|
# module: |
|
||||||
|
#
|
||||||
provider "proxmox" {
|
# provider "proxmox" {
|
||||||
pm_parallel = 1
|
# pm_parallel = 1
|
||||||
pm_tls_insecure = true
|
# pm_tls_insecure = true
|
||||||
pm_api_url = var.pm_api_url
|
# pm_api_url = var.pm_api_url
|
||||||
pm_user = var.pm_user
|
# pm_user = var.pm_user
|
||||||
pm_password = var.pm_password
|
# pm_password = var.pm_password
|
||||||
pm_debug = false
|
# pm_debug = false
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
variable "pm_api_url" {
|
# variable "pm_api_url" {
|
||||||
description = "API URL to Proxmox provider"
|
# description = "API URL to Proxmox provider"
|
||||||
type = string
|
# type = string
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
variable "pm_password" {
|
# variable "pm_password" {
|
||||||
description = "Passowrd to Proxmox provider"
|
# description = "Passowrd to Proxmox provider"
|
||||||
type = string
|
# type = string
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
variable "pm_user" {
|
# variable "pm_user" {
|
||||||
description = "Username to Proxmox provider"
|
# description = "Username to Proxmox provider"
|
||||||
type = string
|
# type = string
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
locals {
|
# locals {
|
||||||
sshkeys = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEphzWgwUZnvL6E5luKLt3WO0HK7Kh63arSMoNl5gmjzXyhG1DDW0OKfoIl0T+JZw/ZjQ7iii6tmSLFRk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hoWwtxYEOhKXoLNjBaeDRnO5OY5AQJvONWpuByyz0R/gTh4bOFVD+Y8WWlKbT4zfhnN70XvapRsbZiaGhJBPwByAMGg6XxSbC6xtbyligVGCEjCXbTLkeKq1w0DuItY+FBGO3J2k90OiciTVSeyiVz9J/Y03UB0gHdsMCoVNrj+9QWfrTLDhM7D5YrXUt5nj2LQTcbtf49zoQXWxUhozlg42E/FJU/Yla7y55qWizAEVyP2/Ks/PHrF679k59HNd2IJ/aicA9QnmWtLQ== ansible"
|
||||||
template = "Debian12-Template"
|
# template = "Debian12-Template"
|
||||||
format = "raw"
|
# format = "raw"
|
||||||
dnsserver = "192.168.10.1"
|
# dnsserver = "192.168.10.1"
|
||||||
vlan = 10
|
# vlan = 10
|
||||||
testVM = {
|
# testVM = {
|
||||||
tags = "test"
|
# tags = "test"
|
||||||
count = 1
|
# count = 1
|
||||||
name = ["test-server"]
|
# name = ["test-server"]
|
||||||
cores = 2
|
# cores = 2
|
||||||
memory = "4096"
|
# memory = "4096"
|
||||||
drive = 20
|
# drive = 20
|
||||||
storage = "cache-domains"
|
# storage = "cache-domains"
|
||||||
node = ["mothership"]
|
# node = ["mothership"]
|
||||||
ip = ["99"]
|
# ip = ["99"]
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
resource "proxmox_vm_qemu" "testVM" {
|
# resource "proxmox_vm_qemu" "testVM" {
|
||||||
count = local.testVM.count
|
# count = local.testVM.count
|
||||||
ciuser = "administrator"
|
# ciuser = "administrator"
|
||||||
vmid = "${local.vlan}${local.testVM.ip[count.index]}"
|
# vmid = "${local.vlan}${local.testVM.ip[count.index]}"
|
||||||
name = local.testVM.name[count.index]
|
# name = local.testVM.name[count.index]
|
||||||
target_node = local.testVM.node[count.index]
|
# target_node = local.testVM.node[count.index]
|
||||||
clone = local.template
|
# clone = local.template
|
||||||
tags = local.testVM.tags
|
# tags = local.testVM.tags
|
||||||
qemu_os = "l26"
|
# qemu_os = "l26"
|
||||||
full_clone = true
|
# full_clone = true
|
||||||
os_type = "cloud-init"
|
# os_type = "cloud-init"
|
||||||
agent = 1
|
# agent = 1
|
||||||
cores = local.testVM.cores
|
# cores = local.testVM.cores
|
||||||
sockets = 1
|
# sockets = 1
|
||||||
cpu_type = "host"
|
# cpu_type = "host"
|
||||||
memory = local.testVM.memory
|
# memory = local.testVM.memory
|
||||||
scsihw = "virtio-scsi-pci"
|
# scsihw = "virtio-scsi-pci"
|
||||||
#bootdisk = "scsi0"
|
# #bootdisk = "scsi0"
|
||||||
boot = "order=virtio0"
|
# boot = "order=virtio0"
|
||||||
onboot = true
|
# onboot = true
|
||||||
sshkeys = local.sshkeys
|
# sshkeys = local.sshkeys
|
||||||
vga {
|
# vga {
|
||||||
type = "serial0"
|
# type = "serial0"
|
||||||
}
|
# }
|
||||||
serial {
|
# serial {
|
||||||
id = 0
|
# id = 0
|
||||||
type = "socket"
|
# type = "socket"
|
||||||
}
|
# }
|
||||||
disks {
|
# disks {
|
||||||
ide {
|
# ide {
|
||||||
ide2 {
|
# ide2 {
|
||||||
cloudinit {
|
# cloudinit {
|
||||||
storage = local.testVM.storage
|
# storage = local.testVM.storage
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
virtio {
|
# virtio {
|
||||||
virtio0 {
|
# virtio0 {
|
||||||
disk {
|
# disk {
|
||||||
size = local.testVM.drive
|
# size = local.testVM.drive
|
||||||
format = local.format
|
# format = local.format
|
||||||
storage = local.testVM.storage
|
# storage = local.testVM.storage
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
network {
|
# network {
|
||||||
id = 0
|
# id = 0
|
||||||
model = "virtio"
|
# model = "virtio"
|
||||||
bridge = "vmbr0"
|
# bridge = "vmbr0"
|
||||||
tag = local.vlan
|
# tag = local.vlan
|
||||||
}
|
# }
|
||||||
#Cloud Init Settings
|
# #Cloud Init Settings
|
||||||
ipconfig0 = "ip=192.168.${local.vlan}.${local.testVM.ip[count.index]}/24,gw=192.168.${local.vlan}.1"
|
# ipconfig0 = "ip=192.168.${local.vlan}.${local.testVM.ip[count.index]}/24,gw=192.168.${local.vlan}.1"
|
||||||
searchdomain = "durp.loc"
|
# searchdomain = "durp.loc"
|
||||||
nameserver = local.dnsserver
|
# nameserver = local.dnsserver
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
writeConnectionSecretToRef:
|
# writeConnectionSecretToRef:
|
||||||
namespace: crossplane
|
# namespace: crossplane
|
||||||
name: opentofu-workspace-example-inline
|
# name: opentofu-workspace-example-inline
|
||||||
|
|||||||
Reference in New Issue
Block a user