Skip to content

Commit

Permalink
fix: Fix vm update (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
bilby91 committed Jul 17, 2024
1 parent 82f3b32 commit 5a6a3b0
Show file tree
Hide file tree
Showing 11 changed files with 550 additions and 325 deletions.
19 changes: 16 additions & 3 deletions docs/resources/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,28 @@ data "crunchloop_vmi" "ubuntu" {
name = "Ubuntu 24.04 (noble)"
}
resource "crunchloop_vm" "default" {
name = "terraform-vm"
# You can be assign a host directly to a VM
#
resource "crunchloop_vm" "with_host" {
name = "terraform-with-host"
vmi_id = data.crunchloop_vmi.ubuntu.id
host_id = data.crunchloop_host.test-1.id
cores = 1
memory_megabytes = 1024
root_volume_size_gigabytes = 10
user_data = base64encode("echo 'Hello, World!'")
}
# Or the can let the system allocate the host for you
#
resource "crunchloop_vm" "without_host" {
name = "terraform-without-host"
vmi_id = data.crunchloop_vmi.ubuntu.id
cores = 1
memory_megabytes = 1024
root_volume_size_gigabytes = 10
user_data = base64encode("echo 'Hello, World!'")
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -50,14 +63,14 @@ resource "crunchloop_vm" "default" {
### Required

- `cores` (Number) Virtual CPU cores
- `host_id` (Number) Identifier of the Host where the Vm will be created
- `memory_megabytes` (Number) Memory (MiB)
- `name` (String) Name of the Vm
- `root_volume_size_gigabytes` (Number) Root volume size (GiB)
- `vmi_id` (Number) Identifier of the VMI to use for the Vm

### Optional

- `host_id` (Number) Identifier of the Host where the Vm will be created
- `ssh_key` (String) Ssh public key to authenticate with the Vm
- `user_data` (String) Cloud init user data shell script, base64 encoded

Expand Down
17 changes: 15 additions & 2 deletions examples/resources/crunchloop_vm/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@ data "crunchloop_vmi" "ubuntu" {
name = "Ubuntu 24.04 (noble)"
}

resource "crunchloop_vm" "default" {
name = "terraform-vm"
# You can be assign a host directly to a VM
#
resource "crunchloop_vm" "with_host" {
name = "terraform-with-host"
vmi_id = data.crunchloop_vmi.ubuntu.id
host_id = data.crunchloop_host.test-1.id
cores = 1
memory_megabytes = 1024
root_volume_size_gigabytes = 10
user_data = base64encode("echo 'Hello, World!'")
}

# Or the can let the system allocate the host for you
#
resource "crunchloop_vm" "without_host" {
name = "terraform-without-host"
vmi_id = data.crunchloop_vmi.ubuntu.id
cores = 1
memory_megabytes = 1024
root_volume_size_gigabytes = 10
user_data = base64encode("echo 'Hello, World!'")
}
Loading

0 comments on commit 5a6a3b0

Please sign in to comment.