From f130f9848e61924bded600602a91822cf76e0959 Mon Sep 17 00:00:00 2001 From: Eamonn O'Toole Date: Thu, 2 Mar 2017 11:00:59 +0000 Subject: Write Ignition file as a volume in a libvirt storage pool This avoids the problem where the Ignition file is remote to the host on which the libvirt domain is being created. We've added a "libvirt_ignition" resource which manages the Ignition file in the libvirt volume - creates it, and destroys it. The "coreos_ignition" field in the libvirt_domain definition must point to the Id of a "libvirt_ignition" resource. The code is modelled on that used for CloudInit. --- .../libvirt/r/coreos_ignition.html.markdown | 38 ++++++++++++++++++++++ docs/providers/libvirt/r/domain.html.markdown | 14 +++++--- 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 docs/providers/libvirt/r/coreos_ignition.html.markdown (limited to 'docs') diff --git a/docs/providers/libvirt/r/coreos_ignition.html.markdown b/docs/providers/libvirt/r/coreos_ignition.html.markdown new file mode 100644 index 00000000..ae95e77b --- /dev/null +++ b/docs/providers/libvirt/r/coreos_ignition.html.markdown @@ -0,0 +1,38 @@ +--- +layout: "libvirt" +page_title: "Libvirt: libvirt_ignition" +sidebar_current: "docs-libvirt-ignition" +description: |- + Manages a CoreOS Ignition file to supply to a domain +--- + +# libvirt\_ignition + +Manages a [CoreOS Ignition](https://coreos.com/ignition/docs/latest/supported-platforms.html) +file written as a volume to a libvirt storage pool that can be used to customize a CoreOS Domain during 1st +boot. + +## Example Usage + +``` +resource "libvirt_ignition" "ignition" { + name = "example.ign" + content = +} + +``` + +## 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. +* `content` - (Required) This points to the source of the Ignition configuration + information that will be used to create the Ignition file in the libvirt + storage pool. The `content` can be + * The name of file that contains Ignition configuration data, or its contents + * A rendered Terraform Ignition object + +Any change of the above fields will cause a new resource to be created. diff --git a/docs/providers/libvirt/r/domain.html.markdown b/docs/providers/libvirt/r/domain.html.markdown index af3d7247..a779a69b 100644 --- a/docs/providers/libvirt/r/domain.html.markdown +++ b/docs/providers/libvirt/r/domain.html.markdown @@ -41,10 +41,9 @@ The following arguments are supported: cloud-init won't cause the domain to be recreated, however the change will have effect on the next reboot. -The following extra argument is provided for CoreOS images: - -* `coreos_ignition` - (Optional) This can be set to the name of an existing ignition -file or alternatively can be set to the rendered value of a Terraform ignition provider object. +There is an optional `coreos_ignition` parameter: +* `coreos_ignition` (Optional) The `libvirt_ignition` resource that is to be used by + the CoreOS domain. An example where a Terraform ignition provider object is used: ``` @@ -61,8 +60,13 @@ resource "ignition_config" "example" { ] } +resource "libvirt_ignition" "ignition" { + name = "ignition" + content = "${ignition_config.example.rendered}" +} + resource "libvirt_domain" "my_machine" { - coreos_ignition = "${ignition_config.example.rendered}" + coreos_ignition = "${libvirt_ignition.ignition.id}" ... } ``` -- cgit v1.2.3