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.
Given a simple salt-ssh tree with a Saltfile:
salt-ssh: config_dir: etc/salt max_procs: 30 wipe_ssh: True
and etc/salt/master
:
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:
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.
Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/roster/all/salt.roster.terraform.html