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

Add a intermediate resource to manage machines #225

Open
Freddo3000 opened this issue Jul 28, 2024 · 2 comments
Open

Add a intermediate resource to manage machines #225

Freddo3000 opened this issue Jul 28, 2024 · 2 comments

Comments

@Freddo3000
Copy link

I'd like if there was a intermediate resource between machine and instance so a user can configure parameters unrelated to power parameters, such as domain, hostname, pool, etc, as well as configuring network interfaces that cannot otherwise be allocated using the maas_instance resource.

For example,

// Find a few machines and allocate them, set them to appropriate resource pools
resource "maas_allocation" "example" {
  count = 3
  // Parameters used for finding machines to allocate.
  // Machines found are changed to be "allocated" https://maas.io/docs/how-to-allocate-machines-with-maas
  system_id = maas_machine.example[count.index].system_id  // Or leave null
  min_memory = 12345
  min_cpu_count = 12
  tags = [...]
  zone = "some_AZ"
  
  // Parameters that change the machine parameters
  hostname = "my_new_hostname"
  domain = "a non-default domain"
  pool = "a non-default pool"

  mark = true // New: Mark machine as "Allocated" in MAAS
}

// Create a few VLAN interfaces, as these cannot be created after a machine has been deployed
resource "maas_network_interface_vlan" "example" {
  count = length(maas_allocation.example)
  depends_on = [maas_allocation.example]
  fabric = "fabric-1"
  machine = maas_llocation.example[count.index].system_id // or fqdn, or hostname
  parent = "ens1"

  vlan = 123
}

// Or block devices...
resource "maas_block_device" "example" {
  count = length(maas_allocation.example)
  depends_on = [maas_allocation.example]
  machine = maas_llocation.example[count.index].system_id // or fqdn, or hostname
  ...
}

// Deploy the allocated machines
resource "maas_instance" "example" {
  count = length(maas_allocation.example)
  depends_on = [maas_allocation.example, maas_network_interface_vlan.example, maas_block_device.example]

  allocate_params {
    // Machines marked as "Allocated" should only be able to be deployed by specifying the
    // host or system_id
    hostname = maas_allocation.example[count.index].hostname
    system_id = maas_allocation.example[count.index].system_id // Known from the previous allocation.
  }
}
Copy link

This issue is stale because it has been open for 30 days with no activity.

Copy link

github-actions bot commented Oct 3, 2024

This issue is stale because it has been open for 30 days with no activity.

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

2 participants