File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/roster/__pycache__/terraform.cpython-310.pyc
o
�N�g� �
@ s� d Z ddlZddlZddlZddlZe�e�Z dZ
ddddddddddddd�Zd Zd
d� Z
dd
� Zdd� Zdd� Zddd�Zdd� Zdd� Zddd�ZdS )a�
Dynamic roster from terraform current state
===========================================
This roster module allows you dynamically generate the roster from the terraform
resources defined with the `Terraform Salt`_ provider.
It exposes all salt_host resources with the same attributes to the salt-ssh
roster, making it completely independent of the type of terraform resource, and
providing the integration using terraform constructs with interpolation.
Basic Example
-------------
Given a simple salt-ssh tree with a Saltfile:
.. code-block:: yaml
salt-ssh:
config_dir: etc/salt
max_procs: 30
wipe_ssh: True
and ``etc/salt/master``:
.. code-block:: yaml
root_dir: .
file_roots:
base:
- srv/salt
pillar_roots:
base:
- srv/pillar
roster: terraform
In the same folder as your ``Saltfile``, create terraform file with resources
like cloud instances, virtual machines, etc. For every single one of those that
you want to manage with Salt, create a ``salt_host`` resource:
.. code-block:: text
resource "salt_host" "dbminion" {
salt_id = "dbserver"
host = "${libvirt_domain.vm-db.network_interface.0.addresses.0}"
user = "root"
passwd = "linux"
}
You can use the count attribute to create multiple roster entries with a single
definition. Please refer to the `Terraform Salt`_ provider for more detailed
examples.
.. _Terraform Salt: https://github.com/dmacvicar/terraform-provider-salt
� Nzsalt.roster.�s�i�b�m)�host�user�passwd�portZsudoZ sudo_userZtty�priv�timeoutZminion_optsZthin_dirZ cmd_umaskZsalt_idc C sf i }| � di �� di �}|� t�|t<