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

[RC2 fixes] fix cloudinit disk slot and pm_parallel oddities #947

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/resources/vm_qemu.md
Copy link
Collaborator

Choose a reason for hiding this comment

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

Somewhere in the docs it should say that ide2 is reserve, because of the change withe the cloud-init disk.

Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The following arguments are supported in the top level resource block.
| `scsihw` | `str` | `"lsi"` | The SCSI controller to emulate. Options: `lsi`, `lsi53c810`, `megasas`, `pvscsi`, `virtio-scsi-pci`, `virtio-scsi-single`. |
| `pool` | `str` | | The resource pool to which the VM will be added. |
| `tags` | `str` | | Tags of the VM. This is only meta information. |
| `force_create` | `bool` | `false` | If `false`, and a vm of the same name, on the same node exists, terraform will attempt to reconfigure that VM with these settings. Set to true to always create a new VM (note, the name of the VM must still be unique, otherwise an error will be produced.) |
| `force_create` | `bool` | `false` | If `false`, and a VM of the same name, on the same node exists, terraform will attempt to reconfigure that VM with these settings. Set to true to always create a new VM (note, the name of the VM must still be unique, otherwise an error will be produced.) |
| `os_type` | `str` | | Which provisioning method to use, based on the OS type. Options: `ubuntu`, `centos`, `cloud-init`. |
| `force_recreate_on_change_of` | `str` | | If the value of this string changes, the VM will be recreated. Useful for allowing this resource to be recreated when arbitrary attributes change. An example where this is useful is a cloudinit configuration (as the `cicustom` attribute points to a file not the content). |
| `os_network_config` | `str` | | Only applies when `define_connection_info` is true. Network configuration to be copied into the VM when preprovisioning `ubuntu` or `centos` guests. The specified configuration is added to `/etc/network/interfaces` for Ubuntu, or `/etc/sysconfig/network-scripts/ifcfg-eth0` for CentOS. Forces re-creation on change. |
Expand Down Expand Up @@ -369,7 +369,7 @@ See the [docs about disks](https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_h
| `iops_wr_burst_length` | `int` | `0` | `all` | Length of the write burst duration in seconds. `0` means the default duration dictated by proxmox. |
| `iops_wr_concurrent` | `int` | `0` | `all` | Maximum number of iops while writing concurrently. `0` means unlimited. |
| `iothread` | `bool` | `false` | `scsi`, `virtio` | Whether to use iothreads for this drive. Only effective when the the emulated controller type (`scsihw` top level block argument) is `virtio-scsi-single`. |
| `linked_disk_id` | `int` | | `all` | **Computed** The `vmid` of the linked vm this disk was cloned from. |
| `linked_disk_id` | `int` | | `all` | **Computed** The `vmid` of the linked VM this disk was cloned from. |
| `mbps_r_burst` | `float` | `0.0` | `all` | Maximum read speed in megabytes per second. `0` means unlimited. |
| `mbps_r_concurrent` | `float` | `0.0` | `all` | Maximum read speed in megabytes per second. `0` means unlimited. |
| `mbps_wr_burst` | `float` | `0.0` | `all` | Maximum write speed in megabytes per second. `0` means unlimited. |
Expand Down Expand Up @@ -483,7 +483,7 @@ In addition to the arguments above, the following attributes can be referenced f
| ---------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ssh_host` | `str` | Read-only attribute. Only applies when `define_connection_info` is true. The hostname or IP to use to connect to the VM for preprovisioning. This can be overridden by defining `ssh_forward_ip`, but if you're using cloud-init and `ipconfig0=dhcp`, the IP reported by qemu-guest-agent is used, otherwise the IP defined in `ipconfig0` is used. |
| `ssh_port` | `str` | Read-only attribute. Only applies when `define_connection_info` is true. The port to connect to the VM over SSH for preprovisioning. If using cloud-init and a port is not specified in `ssh_forward_ip`, then 22 is used. If not using cloud-init, a port on the `target_node` will be forwarded to port 22 in the guest, and this attribute will be set to the forwarded port. |
| `default_ipv4_address` | `str` | Read-only attribute. Only applies when `agent` is `1` and Proxmox can actually read the ip the vm has. |
| `default_ipv4_address` | `str` | Read-only attribute. Only applies when `agent` is `1` and Proxmox can actually read the ip the VM has. |

## Import

Expand Down
104 changes: 52 additions & 52 deletions examples/cloudinit_example.tf
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
provider "proxmox" {
pm_tls_insecure = true
pm_api_url = "https://proxmox-server01.example.com:8006/api2/json"
pm_password = "secret"
pm_user = "terraform-prov@pve"
pm_otp = ""
pm_tls_insecure = true
pm_api_url = "https://proxmox-server01.example.com:8006/api2/json"
pm_password = "secret"
pm_user = "terraform-prov@pve"
pm_otp = ""
}

resource "proxmox_vm_qemu" "cloudinit-test" {
name = "terraform-test-vm"
desc = "A test for using terraform and cloudinit"

# Node name has to be the same name as within the cluster
# this might not include the FQDN
target_node = "proxmox-server02"

# The destination resource pool for the new VM
pool = "pool0"

# The template name to clone this vm from
clone = "linux-cloudinit-template"

# Activate QEMU agent for this VM
agent = 1

os_type = "cloud-init"
cores = 2
sockets = 1
vcpus = 0
cpu = "host"
memory = 2048
scsihw = "lsi"

# Setup the disk
disk {
size = 32
type = "virtio"
storage = "ceph-storage-pool"
storage_type = "rbd"
iothread = 1
ssd = 1
discard = "on"
}

# Setup the network interface and assign a vlan tag: 256
network {
model = "virtio"
bridge = "vmbr0"
tag = 256
}

# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=192.168.10.20/24,gw=192.168.10.1"

sshkeys = <<EOF
name = "terraform-test-vm"
desc = "A test for using terraform and cloudinit"

# Node name has to be the same name as within the cluster
# this might not include the FQDN
target_node = "proxmox-server02"

# The destination resource pool for the new VM
pool = "pool0"

# The template name to clone this VM from
clone = "linux-cloudinit-template"

# Activate QEMU agent for this VM
agent = 1

os_type = "cloud-init"
cores = 2
sockets = 1
vcpus = 0
cpu = "host"
memory = 2048
scsihw = "lsi"

# Setup the disk
disk {
size = 32
type = "virtio"
storage = "ceph-storage-pool"
storage_type = "rbd"
iothread = 1
ssd = 1
discard = "on"
}

# Setup the network interface and assign a vlan tag: 256
network {
model = "virtio"
bridge = "vmbr0"
tag = 256
}

# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=192.168.10.20/24,gw=192.168.10.1"

sshkeys = <<EOF
ssh-rsa 9182739187293817293817293871== user@pc
EOF
}
Loading