consulterraform

Announcing General Availability of Consul-Terraform-Sync 0.2

CTS 0.2 includes Task Run Conditions, Terraform 0.15 Support, and more.

We are pleased to announce general availability of Consul-Terraform-Sync (CTS) 0.2. This release further enhances CTS’s capabilities, helping users better manage Day 2+ operations and eliminating the need for manual ticket-based systems. In this blog we will highlight the new features that are available for download on our release page.

»Task Run Conditions

Tasks are the heart of Consul-Terraform-Sync’s automation capabilities. Operators define tasks (address group updates, load balancer pool changes, etc.) in their CTS configurations. When Consul detects a change to the services defined within the task, CTS triggers the appropriate Terraform run to apply the changes. However, there are times when users may not want the run to trigger until certain other conditions have been met. For example a user might prefer to have a task run once all service instances have been deregistered from Consul’s catalog so only one Terraform run is needed to clean up the environment. CTS 0.2 enables this functionality through a feature called task run conditions.

With task run conditions, users can specify certain events that need to occur prior to the task being executed. Conditions include tasks running only when:

  • The first instance of a service is registered
  • All service instances have been deregistered

The default setting for CTS will remain that all tasks run on every service change. Users must specify the conditions in order to change this behavior. Details about this feature can be found here.

Task {
  name = “catalog_service_condition_task”
  source = “path/to/catalog-service-module”
  providers = [“my-provider”]
  services = [“web-api”]

  condition “catalog-service” {
    datacenter			= “dc1”
    regexp			= “web.*”
    source_includes_var	= false
    }
}
Task {  name = “catalog_service_condition_task”  source = “path/to/catalog-service-module”  providers = [“my-provider”]  services = [“web-api”]   condition “catalog-service” {    datacenter			= “dc1”    regexp			= “web.*”    source_includes_var	= false    }}

»Enhanced Service Filtering

Consul catalog can scale to a massive number of services. In many cases, users would want to trigger infrastructure automation only for services that match a certain criteria in the Consul catalog. For example, a user might prefer to update the load balancer pool only for services that have production and external tags.

service {
  name = “web”
  filter = “\”production\” in Service.Tags and \”external\” in Service.Tags”
service {  name = “web”  filter = “\”production\” in Service.Tags and \”external\” in Service.Tags”

Enhanced service filtering allows CTS users to filter services based on values in other fields in addition to service tags. This feature also allows users to filter based on heredoc format.

»HashiCorp Linux Repos and Homebrew Tap

CTS is now part of HashiCorp’s official Linux repository, a source of Debian and RPM packages for HashiCorp products. The Debian and RPM package for CTS currently targets popular x86_64/amd64 systemd systems and supports many versions of Debian, Ubuntu, Fedora, CentOS, RHEL, and AmazonLinux. In addition to being a part of the Linux repository, you can also easily and securely install CTS using the popular macOS-based package manager: Homebrew. This will provide you with a smoother experience getting up and running quickly with CTS regardless of the platform you are running.

»Citrix Integration

We recently had Citrix join the HashiCorp Partner Program and launched a new CTS module for Citrix ADC. This module enables users to automatically create, update, and delete Service groups. Using this module, CTS will create a servicegroup for each service and then bind to its servicemembers according to the number of instances for each service as sourced from the Consul service discovery. Once deployed, the servicegroups will remain in sync with the services sourced from Consul. When adding, deleting, or modifying services in Consul, CTS will apply the changes to the servicegroups and its servicemembers reflecting these changes.

»Terraform 0.15 Integration

Users can now configure Consul-Terraform-Sync to download Terraform 0.15 upon installation. While this adds some new functionality, it’s important to note this update introduces some potential breaking changes for users, depending on how they have previously configured CTS or if they have built their own custom modules and are planning to upgrade CTS to Terraform 0.15. For a more detailed explanation of the changes, please refer to these notes.

We are excited to see the continued improvements on Consul-Terraform-Sync. For more information about CTS, please visit our documentation. Consul-Terraform-Sync 0.2 is available now for download.


Sign up for the latest HashiCorp news