Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting version to v1.7.6 on machine config and secrets does not install talos 1.7.6 #196

Open
dansrogers opened this issue Sep 4, 2024 · 4 comments

Comments

@dansrogers
Copy link

Hi,

Setting talos_version on machine config and secrets doesn't cause talos 1.7.6 to be installed.

Relevant terraform configuration

erraform {
  required_providers {
    # todo figure out how to  install 1.7.6 instead of 1.7.0 or 1.8.0-alpha.2
    talos = {
      source = "siderolabs/talos"
      version = "0.6.0-alpha.2"
    }
  }
}

provider "talos" {
  # Configuration options
}

resource "talos_machine_secrets" "this" {
  talos_version   = "v${var.talos_version}"
}

data "talos_machine_configuration" "controlplane" {
  talos_version    = "v${var.talos_version}"
  cluster_name     = var.cluster_name
  cluster_endpoint = var.cluster_endpoint
  machine_type     = "controlplane"
  machine_secrets  = talos_machine_secrets.this.machine_secrets
  config_patches   = [
    file("${path.root}/talos/machine-config-patch.yaml"),
    file("${path.root}/talos/control-plane-patch.yaml")
  ]
}

data "talos_machine_configuration" "worker" {
  talos_version    = "v${var.talos_version}"
  cluster_name     = var.cluster_name
  cluster_endpoint = var.cluster_endpoint
  machine_type     = "worker"
  machine_secrets  = talos_machine_secrets.this.machine_secrets
  config_patches   = [
    file("${path.root}/talos/machine-config-patch.yaml"),
  ]
}

data "talos_client_configuration" "this" {
  cluster_name         = var.cluster_name
  client_configuration = talos_machine_secrets.this.client_configuration
  endpoints            = [module.controlplane.ip_address]
}

resource "talos_machine_configuration_apply" "controlplane" {
  client_configuration        = talos_machine_secrets.this.client_configuration
  machine_configuration_input = data.talos_machine_configuration.controlplane.machine_configuration
  node                        = module.controlplane.ip_address
}

resource "talos_machine_configuration_apply" "worker" {
  client_configuration        = talos_machine_secrets.this.client_configuration
  machine_configuration_input = data.talos_machine_configuration.worker.machine_configuration
  node                        = module.worker.ip_address
}

resource "talos_machine_bootstrap" "this" {
  depends_on = [talos_machine_configuration_apply.controlplane]

  client_configuration = talos_machine_secrets.this.client_configuration
  node                 = module.controlplane.ip_address
}

resource "talos_cluster_kubeconfig" "this" {
  depends_on           = [talos_machine_bootstrap.this]
  client_configuration = talos_machine_secrets.this.client_configuration
  node                 = module.controlplane.ip_address
}

Tested on 0.5.0 and 0.6.0-alpha.2. The former installs 1.7.0 and the latter always installs 1.8.0-alpha.2

@smira
Copy link
Member

smira commented Sep 4, 2024

talos_version is not a version of Talos to be installed, it's a machine configuration contract - you specify there the Talos version cluster was created with. It only controls machine config generation, so that you can generate machine configs compatible with older versions of Talos.

The actual Talos version being installed depends on your boot assets, it's either the disk image itself, or e.g. the version of the installer in the machine.install machine configuration field when booting off an ISO/PXE.

@joeypiccola
Copy link

This is still a bit unclear to me as well. For example, say I generate an image via the image factory at v1.8.3. When I then leverage data.talos_machine_configuration_apply and inspect the machine_configuration in the state file, the machine.install.image is set to ghcr.io/siderolabs/installer:v1.9.0-alpha.0. I figure you'd want these to match, no? Very possible I don't understand the intended usage of the provider. Thanks!

@smira
Copy link
Member

smira commented Dec 2, 2024

There are many ways to install/run Talos depending on the platform.

When you boot from a disk image, install doesn't happen at all, and version of Talos is driven by the version of the disk image.

When booting from an ISO (or PXE booting), install happens, and version of Talos is driven by machine.install.image in the machine configuration (which you should patch with the version of the installer you want to use).

@smira
Copy link
Member

smira commented Dec 2, 2024

It makes sense to follow generic documentation, and apply it to the terraform provider:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants