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:

  config_dir: etc/salt
  max_procs: 30
  wipe_ssh: True

and etc/salt/master:

root_dir: .
      - srv/salt
      - 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.

salt.roster.terraform.targets(tgt, tgt_type='glob', **kwargs)

Returns the roster from the terraform state file, checks opts for location, but defaults to terraform.tfstate