Install Consul-Terraform-Sync

    Installation - 图2

    To install CTS, find the appropriate package for your system and download it as a zip archive. For the CTS Enterprise binary, download a zip archive with the metadata. to run.

    Example:

    1. $ echo $PATH
    2. $ mv ./consul-terraform-sync /usr/local/bin/consul-terraform-sync

    Once installed, verify the installation works by prompting the or -help option. The version outputted for the CTS Enterprise binary includes the +ent metadata.

    1. $ consul-terraform-sync -version

    CTS connects with your Consul cluster in order to monitor the Consul catalog for service changes. These service changes lead to downstream updates to your network devices. You can configure your Consul cluster in CTS with the Consul block. Below is an example:

    1. consul {
    2. address = "localhost:8500"
    3. token = "my-consul-acl-token"

    Once you have identified a Terraform provider for all of your network devices, you can configure them in CTS with a for each network device. Below is an example:

    1. terraform_provider "fake-firewall" {
    2. address = "10.10.10.10"
    3. username = "admin"
    4. password = "password123"
    5. }

    This provider is then used by task(s) to execute a Terraform module that will update the related network device.

    You might have multiple instances of the same type of network device; for example, multiple instances of a firewall or load balancer. You can configure each instance with its own provider block and distinguish it by the alias meta-argument. See multiple provider configurations for more details and an example of the configuration.