canonical / canonical/cloud-init
[docs]: the page "Configuration sources" does not include environment configuration source
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Documentation request
The current implementation in`cloudinit.helpers.ConfigMerger._read_cfg()` also loads configuration from file specified in environment variable `CLOUD_CFG`:
https://github.com/canonical/cloud-init/blob/6725c0f896e0c55176dd0674668b527a3b2cbed9/cloudinit/helpers.py#L253
By the code, this environment configuration has higher priority than anything else but kernel parameters.
That is used in Microsoft Azure cloud data source. By default it [creates a single partition](https://github.com/canonical/cloud-init/blob/6725c0f896e0c55176dd0674668b527a3b2cbed9/cloudinit/sources/DataSourceAzure.py#L293-L302) on the Azure VM ephemeral disk. It also has higher priority than `cloud.cfg.d/` directory, so the only way to override it is supplying configuration via environment.
That is also reflected in the [Microsoft documentation (options 2 and 3)](https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux/create-swap-file-linux-vm#create-a-swap-partition).
FIX: document loading environment configuration in the list "Base configuration".
---
*Reported from: https://cloudinit.readthedocs.io/en/latest/explanation/configuration.html*
Contributor guide
Assessment
This issue has not been assessed yet.