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

feat(vm): add full support for custom cloud-init disks #1167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ForsakenHarmony
Copy link
Contributor

@ForsakenHarmony ForsakenHarmony commented Mar 26, 2024

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

Have already used this in production, but I need to test the additional changes I made for this PR.

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

@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/custom-cloudinit-interface branch from 5486b49 to c6e694c Compare March 26, 2024 04:40
@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/custom-cloudinit-interface branch from c6e694c to a45915d Compare March 26, 2024 05:35
@ForsakenHarmony ForsakenHarmony marked this pull request as ready for review March 26, 2024 05:38
@bpg
Copy link
Owner

bpg commented Mar 30, 2024

Hi @ForsakenHarmony 👋🏼

Thank you for the PR! It's nice to simplify and cleanup the cloud-init handling.
But the new code causes some issue with cloned VM.
make example fails on applying resource_virtual_environment_vm.tf with

proxmox_virtual_environment_vm.trunks-example: Creation complete after 47s [id=103]
╷
│ Error: failed to add cloud-init device: invalid initialization interface type "" (should be one of: ide[n],sata[n],scsi[n])
│ 
│   with proxmox_virtual_environment_vm.data_vm,
│   on resource_virtual_environment_vm.tf line 207, in resource "proxmox_virtual_environment_vm" "data_vm":
│  207: resource "proxmox_virtual_environment_vm" "data_vm" {
│ 
╵

Also, this trivial acceptance test fails (with a different error tho)

func TestAccResourceVMCloudInit(t *testing.T) {
	t.Parallel()

	providerConfig := getProviderConfig(t)

	tests := []struct {
		name  string
		steps []resource.TestStep
	}{
		{"clone template", []resource.TestStep{
			{
				Config: providerConfig + `
				resource "proxmox_virtual_environment_vm" "test_cloudinit1_template" {
					node_name = "pve"
					started   = false
					name 	  = "test-cloudinit1-template"
					template  = "true"
					initialization {
						datastore_id = "local-lvm"
						interface    = "scsi4"
						ip_config {
							ipv4 {
								address = "dhcp"
							}
						}
					}
				}
				resource "proxmox_virtual_environment_vm" "test_cloudinit1" {
					node_name = "pve"
					started   = false
					name 	  = "test-cloudinit1"
					clone {
						vm_id = proxmox_virtual_environment_vm.test_cloudinit1_template.id
					}
					initialization {
						datastore_id = "local-lvm"
						interface    = "scsi4"
					    dns {
    						servers = ["1.1.1.1"]
    					}
						ip_config {
							ipv4 {
								address = "dhcp"
							}
						}
					}
				}
				`,
				Check: resource.ComposeTestCheckFunc(
				//TODO: check if the dns servers are set
				),
			},
			{
				RefreshState: true,
				Destroy:      false,
			},
		}},
	}

	accProviders := testAccMuxProviders(context.Background(), t)

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			t.Parallel()

			resource.Test(t, resource.TestCase{
				ProtoV6ProviderFactories: accProviders,
				Steps:                    tt.steps,
			})
		})
	}
}

Would you please take a look?

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label Mar 30, 2024
@bpg-autobot
Copy link
Contributor

bpg-autobot bot commented Dec 8, 2024

Marking this pull request as stale due to inactivity in the past 180 days. This helps us focus on the active pull requests. If this pull request receives no comments in the next 30 days it will automatically be closed. If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

@bpg-autobot bpg-autobot bot added the stale label Dec 8, 2024
@bpg bpg requested a review from Copilot December 14, 2024 00:58

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

@bpg-autobot bpg-autobot bot removed the stale label Dec 15, 2024
@ForsakenHarmony
Copy link
Contributor Author

Sorry, I can't find the time right now to go over this PR again, I might at some point in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌛ pending author's response Requested additional information from the reporter size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants