Skip to content

snowplow-devops/terraform-snowplow-telemetry

Repository files navigation

Release CI License Registry

terraform-snowplow-telemetry

A Terraform module which tracks telemetry information back to Snowplow Analytics Ltd so that we can better understand how our community is leveraging the OSS Terraform modules we make available. It is also responsible for generating the tracking tags and user-data scripts which are added to upstream application specific modules.

Usage

This module uses a combination of the Snowplow Terraform provider and Snowplow Tracking CLI to achieve these telemetry goals. Within the module itself we will track the state of the module itself and what state it is in.

For use outside of this module we produce a user-data script which tracks the state of the VM an application is running on with a startup, shutdown and heartbeat event (60 minute interval).

module "telemetry" {
  source = "snowplow-devops/telemetry/snowplow"

  count = var.telemetry_enabled ? 1 : 0

  user_provided_id = var.user_provided_id
  cloud            = "AWS"
  region           = data.aws_region.current.name
  app_name         = var.app_name
  app_version      = var.app_version
  module_name      = var.module_name
  module_version   = var.module_version
}

Note: See the templates for the exact user-data that is executed.

Requirements

Name Version
terraform >= 1.0.0
random >= 3
snowplow >= 0.4

Providers

Name Version
random >= 3
snowplow >= 0.4

Modules

No modules.

Resources

Name Type
random_id.auto_generated_id resource
snowplow_track_self_describing_event.telemetry resource

Inputs

Name Description Type Default Required
app_name The name of the application. string n/a yes
app_version The version of the application (e.g. 1.0.0). string n/a yes
cloud The cloud the services are running in. string n/a yes
module_name The name of the terraform module. string n/a yes
module_version The version of the terraform module (e.g. 1.0.0). string n/a yes
region The region the services are running in. string n/a yes
user_provided_id Optional ID provided by user as an input to each terraform module. Intended to tie events together across modules, infrastructure and apps when used consistently. string n/a yes
app_name_override_1 An application name override for modules that deploy N micro-services. string "" no
app_name_override_2 An application name override for modules that deploy N micro-services. string "" no
app_name_override_3 An application name override for modules that deploy N micro-services. string "" no

Outputs

Name Description
amazon_linux_2_user_data User-data shell chunk for adding telemetry to an Amazon Linux 2 server
amazon_linux_2_user_data_1 User-data shell chunk for adding telemetry to an Amazon Linux 2 server
amazon_linux_2_user_data_2 User-data shell chunk for adding telemetry to an Amazon Linux 2 server
amazon_linux_2_user_data_3 User-data shell chunk for adding telemetry to an Amazon Linux 2 server
auto_generated_id The Snowplow OSS auto-generated ID for stitching together entities of the module being tracked
azurerm_ubuntu_22_04_user_data User-data shell chunk for adding telemetry to an Ubuntu 22.04 server
azurerm_ubuntu_22_04_user_data_1 User-data shell chunk for adding telemetry to an Ubuntu 22.04 server
azurerm_ubuntu_22_04_user_data_2 User-data shell chunk for adding telemetry to an Ubuntu 22.04 server
azurerm_ubuntu_22_04_user_data_3 User-data shell chunk for adding telemetry to an Ubuntu 22.04 server
collector_uri The Snowplow OSS Collector URI to use in collection of telemetry details
gcp_ubuntu_20_04_user_data User-data shell chunk for adding telemetry to an Ubuntu 20.04 server
gcp_ubuntu_20_04_user_data_1 User-data shell chunk for adding telemetry to an Ubuntu 20.04 server
gcp_ubuntu_20_04_user_data_2 User-data shell chunk for adding telemetry to an Ubuntu 20.04 server
gcp_ubuntu_20_04_user_data_3 User-data shell chunk for adding telemetry to an Ubuntu 20.04 server
id The id of the tracking resource

Copyright and license

The Terraform Snowplow Telemetry project is Copyright 2021-2023 Snowplow Analytics Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.