Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.54 KB

cloudinit.html.markdown

File metadata and controls

53 lines (41 loc) · 1.54 KB
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

libvirt_cloudinit_disk

Manages a cloud-init ISO disk that can be used to customize a domain during first boot.

Example Usage

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

Argument Reference

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, the default 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.