layout | page_title | sidebar_current | description |
---|---|---|---|
libvirt |
Libvirt: libvirt_cloudinit_disk |
docs-libvirt-cloudinit-disk |
Manages a cloud-init ISO disk to attach to a domain |
Manages a cloud-init ISO disk that can be used to customize a domain during first boot.
resource "libvirt_cloudinit_disk" "commoninit" {
name = "commoninit.iso"
user_data = data.template_file.user_data.rendered
}
data "template_file" "user_data" {
template = file("${path.module}/cloud_init.cfg")
}
where cloud_init_cfg
is a file on same dir level of the terraform tf.file
#cloud-config
ssh_pwauth: True
chpasswd:
list: |
root:linux
expire: False
In this example we change with help of cloud-init the root pwd. Take also insipiration from ubuntu.tf https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/examples/v0.12/ubuntu/ubuntu-example.tf
The following arguments are supported:
-
name
- (Required) A unique name for the resource, required by libvirt. -
pool
- (Optional) The pool where the resource will be created. If not given, thedefault
pool will be used. For user_data, network_config and meta_data parameters have a look at upstream doc: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html#datasource-nocloud -
user_data
- (Optional) cloud-init user data. -
meta_data
- (Optional) cloud-init user data. -
network_config
- (Optional) cloud-init network-config data.