Skip to content

Commit

Permalink
fixup! doc: do not document user.meta-data key
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Sep 26, 2024
1 parent 4644ccf commit 74948e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
15 changes: 6 additions & 9 deletions doc/rtd/explanation/instancedata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ Instance metadata
What is ``instance-data?``
==========================

Each cloud provider presents unique configuration metadata to a launched cloud
instance. ``Cloud-init`` crawls this metadata and then caches and exposes this
information as a standardised and versioned JSON object known as
``instance-data``. This ``instance-data`` may then be queried or later used
by ``cloud-init`` in templated configuration and scripts.
``instance-data`` is a JSON object which contains instance-specific variables
in a standardized format. These variables may be used in ``cloud-init``
templated cloud-init configurations.

An example of a small subset of instance-data on a launched EC2 instance:

Expand All @@ -42,10 +40,9 @@ An example of a small subset of instance-data on a launched EC2 instance:
Discovery
=========

One way to easily explore which ``instance-data`` variables are available on
your machine is to use the :ref:`cloud-init query<cli_query>` tool.
Warnings or exceptions will be raised on invalid ``instance-data`` keys,
paths or invalid syntax.
``instance-data`` can be inspected on a launched instance using
:ref:`cloud-init query<cli_query>`. Warnings or exceptions will be raised
on invalid ``instance-data`` keys, paths, or invalid syntax.

The :command:`query` command also publishes ``userdata`` and ``vendordata``
keys to the root user which will contain the decoded user and vendor data
Expand Down
29 changes: 21 additions & 8 deletions doc/rtd/reference/datasources/lxd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,27 @@ launched container, use either LXD profiles or
one of the following keys:

- ``cloud-init.vendor-data``: YAML which overrides any metadata values.
- ``cloud-init.network-config``: YAML representing either :ref:`network_config_v1` or
:ref:`network_config_v2` format.
- ``cloud-init.user-data``: YAML which takes precedence and overrides both metadata
and vendor data values.
- ``user.any-key``: Custom user configuration key and value pairs, which can be
passed to ``cloud-init``. Those keys/values will be present in instance-data
which can be used by both `#template: jinja` #cloud-config templates and
the :command:`cloud-init query` command.
- ``cloud-init.network-config``: YAML representing either
:ref:`network_config_v1` or :ref:`network_config_v2` format.
- ``cloud-init.user-data``: YAML which takes precedence and overrides both
metadata and vendor data values.
- ``user.<any-key>``: Keys prefixed with ``user.`` are included in
:ref:`instance data<instance_metadata>`. under ``ds.config.user.``. These
key-value pairs are used in :ref:`jinja templates<user_data_formats-jinja>`
and may be inspected on a launched instance using
``cloud-init query ds.config``.

.. note::

Periods (.) and hyphens (-) in Jinja2 have special meaning. Keys which contain a
period or hyphen cannot use dot notation to access nested values. To support dot
notation, cloud-init provides an alias by converting each hyphen (-) and period (.)
character to an underscore (_). This means that an instance launched with
``-c user.special-key=1FE321`` can be queried using standard jinja notation,
``cloud-init query --format "{{ds.config['user.special-key']}}"`` or may use the alias
notation ``cloud-init query --format "{{ds.config.user_special_key}}"`` or
``cloud-init query ds.config.user_special_key``.


Configuration
=============
Expand Down

0 comments on commit 74948e1

Please sign in to comment.