Skip to content

Azure/terraform-provider-modtm

Terraform ModTM Telemetry Provider

This Terraform provider, named ModTM, is designed to assist with tracking the usage of Terraform modules. It creates a custom modtm_telemetry resource that gathers and sends telemetry data to a specified endpoint. The aim is to provide visibility into the lifecycle of your Terraform modules - whether they are being created, updated, or deleted. This data can be invaluable in understanding the usage patterns of your modules, identifying popular modules, and recognizing those that are no longer in use.

In essence, the ModTM provider enhances your Terraform modules with telemetry capabilities, enabling you to make data-driven decisions while ensuring smooth operations and respect for your data privacy. Its non-blocking nature and controlled data collection make it a safe and valuable addition to your Terraform toolkit.

Minimal and Controlled Data Collection

The ModTM provider is designed with respect for data privacy and control. The only data collected and transmitted are the tags you define in your modtm_telemetry resource, and an uuid which represents a module instance's identifier. No other data from your Terraform modules or your environment is collected or transmitted. This gives you full control over the data you wish to collect for telemetry purposes.

Usage

To use this provider, include the modtm_telemetry resource in your Terraform modules. This resource accepts a map of tags, which can include any data relevant to your needs, such as module name, version, cloud provider, etc. During the lifecycle operations (create, read, update, delete) of your Terraform modules, these tags are sent via a HTTP POST request to a specified endpoint.

Safe Operations

One of the primary design principles of the ModTM provider is its non-blocking nature. The provider is designed to work in a way that any network disconnectedness or errors during the telemetry data sending process will not cause a Terraform error or interrupt your Terraform operations. This makes the ModTM provider safe to use even in network-restricted or air-gaped environments.

If the telemetry data cannot be sent due to network issues, the failure will be logged, but it will not affect the Terraform operation in progress(it might delay your operations for no more than 5 seconds). This ensures that your Terraform operations always run smoothly and without interruptions, regardless of the network conditions.

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
go install

Adding Dependencies

This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency github.com/author/dependency to your Terraform provider:

go get github.com/author/dependency
go mod tidy

Then commit the changes to go.mod and go.sum.

Using the provider

Fill this in for each provider

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To compile the provider, run go install. This will build the provider and put the provider binary in the $GOPATH/bin directory.

To generate or update documentation, run go generate.

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run.

make testacc

Chaos testing

This provider uses Toxiproxy so simulate different network issues, now we've tested:

latency down reset_peer

To run chaos tests, you must install Toxiproxy, or run Toxiproxy's docker container on linux:

docker run -d --rm --network=host ghcr.io/shopify/toxiproxy

You must set environment CHAOS to a non-empty string to enable the chaos tests.