This Terraform module creates local text files. Using this module in automation with Consul Terraform Sync (CTS) will dynamically create or delete text files based off of configured services. This module is useful for testing CTS to observe how it responds to changes in Consul catalog.
When a new service is registered or deregistered a text-file, with the service's name is created or deleted. The content of the text-file is the tags associated with the instances of that service at the time of registration.
Intended to be used with the catalog-services condition.
The module uses the local
Terraform provider to create text files. A directory "resources" is created in the CTS generated task subdirectory. The text files are named after the monitored Consul service instances.
Ecosystem | Version |
---|---|
consul | >= 1.8 |
consul-terraform-sync | >= 0.2.0 |
terraform | >= 0.13 |
Name | Version |
---|---|
local | >= 2.0.0 |
No setup is needed
User Config for Consul Terraform Sync
See Securely Configure Terraform Providers for alternatives to directly inserting token in config file.
example.hcl
task {
name = "task_example"
services = ["api"]
version = "0.0.1"
source = "lornasong/cts_cs_file/local"
condition "catalog-services" {
regexp = ".*"
source_includes_var = true
datacenter = "dc1"
}
}