Reverting to old patch routing

This commit is contained in:
vandomej 2025-09-29 16:36:18 -07:00
parent 4be6e4da19
commit e4cf3bcae7
2 changed files with 18 additions and 62 deletions

View file

@ -1,15 +1,5 @@
terraform {
required_version = ">= 1.0"
required_providers {
talos = {
source = "siderolabs/talos"
version = "~> 0.4"
}
}
}
provider "talos" {
# Configuration options
}
# Load variables from a .tfvars file
@ -94,57 +84,22 @@ resource "null_resource" "talos_cluster" {
}
}
resource "talos_machine_secrets" "this" {}
data "talos_machine_configuration" "this" {
cluster_name = "${var.cluster_name}"
machine_type = "controlplane"
cluster_endpoint = "https://10.5.0.1:6443"
machine_secrets = talos_machine_secrets.this.machine_secrets
}
data "talos_client_configuration" "this" {
cluster_name = "${var.cluster_name}"
client_configuration = talos_machine_secrets.this.client_configuration
nodes = ["10.5.0.2"]
}
resource "talos_machine_configuration_apply" "this" {
depends_on = [ null_resource.talos_cluster ]
client_configuration = talos_machine_secrets.this.client_configuration
machine_configuration_input = data.talos_machine_configuration.this.machine_configuration
node = "10.5.0.2"
config_patches = [
yamlencode({
machine = {
network = {
nameservers = [
"1.1.1.1",
"10.0.0.0"
]
resource "null_resource" "talos_cluster_patches" {
depends_on = [null_resource.talos_cluster]
triggers = {
patches_hash = filesha1("${path.module}/patches/controlplane-patch.yaml")
}
provisioner "local-exec" {
command = <<EOT
# Apply ONLY your custom patches (not the full config)
talosctl patch machineconfig \
--patch-file patches/controlplane-patch.yaml \
--nodes 10.5.0.2
EOT
}
})
]
}
# resource "null_resource" "talos_cluster_patches" {
# depends_on = [null_resource.talos_cluster]
# triggers = {
# patches_hash = filesha1("${path.module}/patches/controlplane-patch.yaml")
# }
# provisioner "local-exec" {
# command = <<EOT
# # Apply ONLY your custom patches (not the full config)
# talosctl patch machineconfig \
# --patch-file patches/controlplane-patch.yaml \
# --nodes 10.5.0.2 \
# --mode reboot
# EOT
# }
# }
output "next_steps" {
value = <<EOT
After applying:

View file

@ -1,4 +1,5 @@
cluster:
apiServer:
certSANs:
- 10.5.0.2
machine:
network:
nameservers:
- 1.1.1.1
- 8.8.8.8