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

fix(lxc): fixes for datastore-backed volume mounts #772

Merged
merged 4 commits into from
Dec 6, 2023

Conversation

bpg
Copy link
Owner

@bpg bpg commented Dec 6, 2023

Contributor's Note

  • I have added / updated documentation in /docs for any user-facing features or additions.
  • I have added / updated templates in /example for any new or updated resources / data sources.
  • I have ran make example to verify that the change works as expected.

Proof of Work

resource "proxmox_virtual_environment_container" "test_container" {
  node_name = var.virtual_environment_node_name

  disk {
    datastore_id = "local-lvm"
    size         = 8
  }

  started = false

  description = <<-EOT
		some
		desc
  EOT

  initialization {
    hostname = "test"

    ip_config {
      ipv4 {
        address = "dhcp"
      }
    }
  }

  network_interface {
    name = "vmbr0"
  }

  operating_system {
    template_file_id = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
    # template_file_id = proxmox_virtual_environment_file.ubuntu_container_template.id
    type             = "ubuntu"
  }

  mount_point {
    volume = "local-lvm"
    size   = "4G"
    path   = "/mnt/local"
  }

  unprivileged = true
}
❯ terraform apply -auto-approve
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - bpg/proxmox in /Users/pasha/go/bin
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with
│ published releases.
╵

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # proxmox_virtual_environment_container.test_container will be created
  + resource "proxmox_virtual_environment_container" "test_container" {
      + description   = <<-EOT
            some
            desc
        EOT
      + id            = (known after apply)
      + node_name     = "pve"
      + start_on_boot = true
      + started       = false
      + template      = false
      + unprivileged  = true
      + vm_id         = -1

      + disk {
          + datastore_id = "local-lvm"
          + size         = 8
        }

      + initialization {
          + hostname = "test"

          + ip_config {
              + ipv4 {
                  + address = "dhcp"
                }
            }
        }

      + mount_point {
          + backup    = true
          + path      = "/mnt/local"
          + quota     = false
          + read_only = false
          + replicate = true
          + shared    = false
          + size      = "8G"
          + volume    = "local-lvm"
        }

      + network_interface {
          + bridge     = "vmbr0"
          + enabled    = true
          + firewall   = false
          + mtu        = 0
          + name       = "vmbr0"
          + rate_limit = 0
          + vlan_id    = 0
        }

      + operating_system {
          + template_file_id = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
          + type             = "ubuntu"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.
proxmox_virtual_environment_container.test_container: Creating...
proxmox_virtual_environment_container.test_container: Still creating... [10s elapsed]
proxmox_virtual_environment_container.test_container: Creation complete after 11s [id=101]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Re-apply the same plan:

❯ terraform apply -auto-approve
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - bpg/proxmox in /Users/pasha/go/bin
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with
│ published releases.
╵
proxmox_virtual_environment_container.test_container: Refreshing state... [id=101]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

In Proxmox UI:
Screenshot 2023-12-06 at 3 57 33 PM

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #760
Relates to #394

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
@bpg bpg force-pushed the fix-lxc-volume-mount-points branch from 6ee40fd to df912a5 Compare December 6, 2023 21:01
@bpg
Copy link
Owner Author

bpg commented Dec 6, 2023

@all-contributors please add @redpimpernel for testing

Copy link
Contributor

@bpg

I've put up a pull request to add @redpimpernel! 🎉

@bpg bpg enabled auto-merge (squash) December 6, 2023 23:28
@bpg bpg added the autoapprove label Dec 6, 2023
Copy link

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 LGTM! beep boop

@bpg bpg merged commit 25deebb into main Dec 6, 2023
8 checks passed
@bpg bpg deleted the fix-lxc-volume-mount-points branch December 6, 2023 23:39
@ghost ghost mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant