Skip to content

gfkse/terraform-aws-ecs-airflow-datadog-agent

Repository files navigation

AWS ECS Airflow Datadog Agent Terraform module

Features

For a given ECS cluster this module creates a service which maintains one task definition to run one datadog agent container.
The container can be assessed by the service discovery endpoint.

The default configuration is focused to monitor Airflow.

How to use it

Example:

module "airflow_monitoring" {
  source = "github.com/gfkse/ecs_airflow_datadog_module?ref=<x.y.z>"

  dd_api_key_parameter_name = "/datadog/apiKey"
  airflow_ecs_cluster_name  = "my-cluster"
  resource_prefix           = "airflow"
  vpc_id                    = "<vpc_id>"
  subnet_ids                = "<subnet_ids>"
  service_endpoint_url      = "http://example.com"
}

Requirements

No requirements.

Providers

Name Version
aws n/a
template n/a

Modules

No modules.

Resources

Name Type
aws_ecs_service.datadog resource
aws_ecs_task_definition.datadog resource
aws_iam_policy.datadog_task_execution_role_policy resource
aws_iam_policy.datadog_task_execution_role_policy_with_kms_key resource
aws_iam_role.datadog_task_execution_role resource
aws_iam_role_policy_attachment.datadog_tasks_execution_role_policy_attachment resource
aws_iam_role_policy_attachment.datadog_tasks_execution_role_policy_attachment_with_kms_key resource
aws_security_group.sg_datadog_internal resource
aws_service_discovery_private_dns_namespace.datadog resource
aws_service_discovery_service.datadog resource
aws_caller_identity.current data source
aws_ecs_cluster.airflow-ecs-cluster data source
aws_region.current data source
aws_vpc.selected_vpc data source
template_file.dd_dogstatsd_mapper_profiles data source

Inputs

Name Description Type Default Required
airflow_ecs_cluster_name Name of the airflow ECS cluster for which the datadog monitoring will be attached. string n/a yes
datadog_container_cpu Desired container cpu. number 10 no
datadog_container_memory Desired container memory. number 256 no
datadog_task_definition https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html list(object({})) null no
datadog_task_definition_cpu Desired task definition cpu. string null no
datadog_task_definition_file_dd_statsd_mapper_profiles https://docs.datadoghq.com/developers/dogstatsd/dogstatsd_mapper/ string null no
datadog_task_definition_memory Desired task definition memory. string null no
datadog_task_definition_network_mode n/a string "awsvpc" no
dd_api_encryption_kms_key_id Required only if your secret uses a custom KMS key and not the default key. The ARN for your custom key should be added as a resource. string "" no
dd_api_key_parameter_name The name of the parameter store secret containing the key to access Datadog API. string n/a yes
region n/a string n/a yes
resource_prefix Prefix name for the resources. string n/a yes
service_endpoint_url The url of the service to check whether it can connect and is healthy: https://docs.datadoghq.com/integrations/airflow/?tab=containerized#configuration string n/a yes
subnet_ids The VPC's private Subnet IDs, where rds, elasticache, alb and ecs cluster will reside. list(string) n/a yes
tags A mapping of tags to assign to the resources in the module. map(string) {} no
vpc_id ID of VPC, where rds, elasticache, alb and ecs cluster will reside. string n/a yes

Outputs

Name Description
service_discovery_endpoint n/a