Blog HCP Consul on Azure goes GA, plus more Consul news from HashiConf EU Read more
  • Overview
    • Consul on Kubernetes
    • Control access with Consul API Gateway
    • Discover Services with Consul
    • Enforce Zero Trust Networking with Consul
    • Load Balancing with Consul
    • Manage Traffic with Consul
    • Multi-Platform Service Mesh with Consul
    • Network Infrastructure Automation with Consul
    • Observability with Consul
  • Enterprise
  • Tutorials
  • Docs
  • API
  • CLI
  • Community
GitHub
Download
Try HCP Consul
    • v1.12.x (latest)
    • v1.11.x
    • v1.10.x
    • v1.9.x
    • v1.8.x
    • Overview
      • Overview
      • What is a Service Mesh?
      • Overview
      • Chef, Puppet, etc.
      • Nagios
      • SkyDNS
      • SmartStack
      • Serf
      • Eureka
      • Istio
      • Envoy and Other Proxies
      • Custom Solutions
    • Overview
    • Manual Bootstrap
    • Consul Agent
    • Glossary
    • Required Ports
    • Bootstrapping a Datacenter
    • Cloud Auto-join
    • Server Performance
    • Kubernetes
  • API
  • Commands (CLI)
    • Register Services - Service Definitions
    • Find Services - DNS Interface
    • Monitor Services - Check Definitions
    • Overview
    • How Service Mesh Works
    • Configuration
      • Overview
      • Ingress Gateway
      • Mesh
      • Exported Services
      • Proxy Defaults
      • Service Defaults
      • Service Intentions
      • Service Resolver
      • Service Router
      • Service Splitter
      • Terminating Gateway
      • Overview
      • Envoy
      • Built-in Proxy
      • Proxy Integration
      • Managed (Deprecated)
      • Overview
      • Proxy Service Registration
      • Sidecar Service Registration
    • Service-to-service permissions - Intentions
    • Service-to-service permissions - Intentions (Legacy Mode)
    • Transparent Proxy
      • Overview
      • UI Visualization
      • Overview
      • Discovery Chain
    • Connectivity Tasks
    • Distributed Tracing
      • Overview
        • WAN Federation
        • Enabling Service-to-service Traffic Across Datacenters
        • Enabling Service-to-service Traffic Across Admin Partitions
      • Ingress Gateways
      • Terminating Gateways
      • What is Cluster Peering
      • Create and Manage Peering Connections
      • Cluster Peering on Kubernetes
    • Nomad
    • Kubernetes
      • Overview
      • Go Integration
      • Overview
      • Built-In CA
      • Vault
      • ACM Private CA
    • Develop and Debug
    • Security
    • Overview
    • Installation
    • Technical Specifications
    • Common Errors
    • Upgrades
    • Overview
    • Architecture
      • Installing Consul on Kubernetes
      • Installing Consul K8s CLI
        • Minikube
        • Kind
        • AKS (Azure)
        • EKS (AWS)
        • GKE (Google Cloud)
        • Red Hat OpenShift
        • Self Hosted Kubernetes
        • Consul Clients Outside Kubernetes
        • Consul Servers Outside Kubernetes
        • Single Consul Datacenter in Multiple Kubernetes Clusters
        • Consul Enterprise
        • Overview
        • Federation Between Kubernetes Clusters
        • Federation Between VMs and Kubernetes
        • Overview
        • Systems Integration
          • Overview
          • Bootstrap Token
          • Enterprise License
          • Gossip Encryption Key
          • Partition Token
          • Replication Token
          • Server TLS
          • Service Mesh Certificates
          • Snapshot Agent Config
          • Webhook Certificates
        • WAN Federation
      • Overview
      • Transparent Proxy
      • Ingress Gateways
      • Terminating Gateways
      • Ingress Controllers
      • Configuring a Connect CA Provider
      • Health Checks
        • Metrics
    • Service Sync
      • Overview
      • Upgrade An Existing Cluster to CRDs
    • Annotations and Labels
    • Consul DNS
      • Upgrading Consul on Kubernetes
      • Upgrading Consul K8s CLI
      • Uninstall
      • Certificate Rotation
      • Gossip Encryption Key Rotation
      • Configure TLS on an Existing Cluster
      • Common Error Messages
      • FAQ
    • Compatibility Matrix
    • Helm Chart Configuration
    • Consul K8s CLI Reference
    • Overview
    • Requirements
    • Task Resource Usage
      • Installation
      • Secure Configuration
      • Migrate Existing Tasks
      • Installation
      • Secure Configuration
      • ACL Controller
    • Architecture
    • Consul Enterprise
    • Configuration Reference
    • Overview
    • Register Lambda Functions
    • Invoke Lambda Functions
    • Overview
      • Installation
      • Requirements
      • Configure
      • Run Consul-Terraform-Sync
    • Architecture
      • Overview
      • Status
      • Tasks
      • Health
      • Overview
      • task
      • start
    • Configuration
    • Tasks
    • Terraform Modules
      • Overview
      • License
      • Terraform Cloud Driver
      • Overview
      • Terraform
      • Terraform Cloud
    • Compatibility
    • Consul KV
    • Sessions
    • Watches
    • Overview
      • General
      • CLI Reference
      • Configuration Reference
    • Configuration Entries
    • Telemetry
    • Sentinel
    • RPC
    • Overview
      • ACL System Overview
      • Tokens
      • Policies
      • Roles
      • Rules Reference
      • Legacy Mode
      • Token Migration
      • ACLs in Federated Datacenters
        • Overview
        • Kubernetes
        • JWT
        • OIDC
        • AWS IAM
    • Encryption
      • Overview
      • Core
      • Network Infrastructure Automation
    • Overview
    • Admin Partitions
    • Audit Logging
    • Automated Backups
    • Automated Upgrades
    • Enhanced Read Scalability
    • Single sign-on - OIDC
    • Redundancy Zones
    • Advanced Federation
    • Network Segments
    • Namespaces
    • NIA with TFE
    • Sentinel
      • Overview
      • FAQ
    • Overview
    • Improving Consul Resilience
    • Anti-Entropy
    • Consensus Protocol
    • Gossip Protocol
    • Jepsen Testing
    • Network Coordinates
    • Consul Integration Program
    • NIA Integration Program
    • Vault Integration
    • Proxy Integration
  • Consul Tools
    • Overview
    • Compatibility Promise
    • Specific Version Details
      • Overview
      • General Process
      • Upgrading to 1.2.4
      • Upgrading to 1.6.9
      • Upgrading to 1.8.13
      • Upgrading to 1.10.0
    • Common Error Messages
    • FAQ
    • Overview
      • v1.11.x
      • v1.10.x
      • v1.9.x
      • v0.3.x
      • v0.2.x
      • v0.1.x
      • v0.4.x
      • v0.3.x
      • v0.2.x
      • v0.6.x
      • v0.5.x
    • Overview
    • ACL
  • Guides
Type '/' to Search

»Consul-Terraform-Sync Command (CLI)

Consul-Terraform-Sync (CTS) is controlled via an easy to use command-line interface (CLI). CTS is only a single command-line application: consul-terraform-sync. CTS can be run as a daemon and execute CLI commands. When CTS is run as a daemon, it acts as a server to the CLI commands. Users can use the commands to interact and modify the daemon as it is running. The complete list of commands is in the navigation to the left. Both the daemon and commands return a non-zero exit status on error.

»Daemon

Running CTS as a daemon without using a command is deprecated in CTS 0.6.0 and will be removed at a much later date in a major release. For information on the preferred way to run CTS as a daemon review the start command docs

When CTS runs as a daemon, there is no default configuration to start CTS. You must set a configuration flag -config-file or -config-dir. For example:

$ consul-terraform-sync start -config-file=config.hcl
$ consul-terraform-sync start -config-file=config.hcl

To review a list of available flags, use the -help or -h flag.

»Commands

In addition to running the daemon, CTS has a set of commands that act as a client to the daemon server. The commands provide a user-friendly experience interacting with the daemon. The commands use the CTS APIs but does not correspond one-to-one with it. Please review the individual commands in the left navigation for more details.

To get help for a command, run: consul-terraform-sync <command> -h

»CLI Structure

CTS commands follow the below structure

consul-terraform-sync <command> [options] [args]
consul-terraform-sync <command> [options] [args]
  • options: Flags to specify additional settings. There are general options that can be used across all commands and command-specific options.
  • args: Required arguments specific to a commands

Example:

consul-terraform-sync task disable -http-addr=http://localhost:2000 task_a
consul-terraform-sync task disable -http-addr=http://localhost:2000 task_a

»Autocompletion

The consul-terraform-sync command features opt-in autocompletion for flags, subcommands, and arguments (where supported).

To enable autocompletion, run:

$ consul-terraform-sync -autocomplete-install
$ consul-terraform-sync -autocomplete-install

After you install autocomplete, you must restart your shell for the change to take effect.

When you start typing a CTS command, press the <tab> key to show a list of available completions. To show available flag completes, type -<tab>.

Autocompletion will query the running CTS server to return helpful argument suggestions. For example, for the task disable command, autocompletion will return the names of all enabled tasks that can be disabled.

When autocompletion makes the query to the running CTS server, it will also use any CTS_* environment variables (for example CTS_ADDRESS) set on the CTS server.

»Example: Use autocomplete to discover how to disable a task

Assume a tab is typed at the end of each prompt line:

$ consul-terraform-sync
start  task

$ consul-terraform-sync task
create   delete   disable   enable

$ consul task disable
task_name_a   task_name_b   task_name_c
$ consul-terraform-sync
start  task

$ consul-terraform-sync task
create   delete   disable   enable

$ consul task disable
task_name_a   task_name_b   task_name_c

»General Options

Below are options that can be used across all commands:

OptionRequiredTypeDescriptionDefault
-portOptionalintegerDeprecated in Consul-Terraform-Sync 0.5.0 and will be removed in a later version. Use -http-addr option instead to specify the address and port of the Consul-Terraform-Sync API.

Port from which the CTS daemon serves its API.
The value is prepended with http://localhost:, but you can specify a different scheme or address with the -http-addr if necessary.
8558
-http-addrOptionalstringAddress and port of the CTS API. You can specify an IP or DNS address.

Alternatively, you can specify a value using the CTS_ADDRESS environment variable.
http://localhost:8558
-ssl-verifyOptionalbooleanEnables verification for TLS/SSL connections to the API if set to true. This does not affect insecure HTTP connections.

Alternatively, you can specify the value using the CTS_SSL_VERIFY environment variable.
true
-ca-certOptionalstringPath to a PEM-encoded certificate authority file that is used to verify TLS/SSL connections. Takes precedence over -ca-path if both are provided.

Alternatively, you can specify the value using the CTS_CACERT environment variable.
none
-ca-pathOptionalstringPath to a directory containing a PEM-encoded certificate authority file that is used to verify TLS/SSL connections.

Alternatively, you can specify the value using the CTS_CAPATH environment variable.
none
-client-cert                                                  OptionalstringPath to a PEM-encoded client certificate that the CTS API requires when verify_incoming is set to true on the API.

Alternatively, you can specify the value using the CTS_CLIENT_CERT environment variable.
none
-client-keyOptionalstringPath to a PEM-encoded client key for the certificate configured with the -client-cert option. This is required if -client-cert is set and if verify_incoming is set to true on the CTS API.

Alternatively, you can specify the value using the CTS_CLIENT_KEY environment variable.
none
github logoEdit this page
IntroGuidesDocsCommunityPrivacySecurityBrandConsent Manager