Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Datadog Process collection for ECS #15

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ This repository contains Terraform infrastructure code which creates AWS resourc
| <a name="input_datadog_agent_container_image"></a> [datadog\_agent\_container\_image](#input\_datadog\_agent\_container\_image) | The datadog agent sidecar container image | `string` | `"datadog/agent:latest"` | no |
| <a name="input_datadog_firelens_container_essential"></a> [datadog\_firelens\_container\_essential](#input\_datadog\_firelens\_container\_essential) | Determines whether all other containers in a task are stopped, if this container fails or stops for any reason | `bool` | `false` | no |
| <a name="input_datadog_firelens_container_image"></a> [datadog\_firelens\_container\_image](#input\_datadog\_firelens\_container\_image) | The datadog firelens sidecar container image | `string` | `"amazon/aws-for-fluent-bit:stable"` | no |
| <a name="input_datadog_process_collection_enabled"></a> [datadog\_process\_collection\_enabled](#input\_datadog\_process\_collection\_enabled) | Whether to enable process collection | `bool` | `true` | no |
| <a name="input_datadog_service_name"></a> [datadog\_service\_name](#input\_datadog\_service\_name) | The datadog service name | `string` | `""` | no |
| <a name="input_datadog_tags"></a> [datadog\_tags](#input\_datadog\_tags) | Tags for datadog agent container. | `string` | `"env:default, service:default, region:default"` | no |
| <a name="input_docker_labels"></a> [docker\_labels](#input\_docker\_labels) | Docker labels to add to the container | `map(string)` | `{}` | no |
Expand Down
4 changes: 4 additions & 0 deletions dd-agent.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module "datadog_sidecar" {

Check failure on line 1 in dd-agent.tf

View workflow job for this annotation

GitHub Actions / build

CKV_TF_1: "Ensure Terraform module sources use a commit hash"
source = "cloudposse/ecs-container-definition/aws"
version = "v0.58.1"

Expand Down Expand Up @@ -52,6 +52,10 @@
name = "DD_TAGS"
value = replace(var.datadog_tags, ",", " ")
},
{
name = "DD_PROCESS_AGENT_PROCESS_COLLECTION_ENABLED"
value = tostring(var.datadog_process_collection_enabled)
}
]

secrets = [
Expand Down
3 changes: 3 additions & 0 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

}

module "container_definition" {

Check failure on line 102 in ecs.tf

View workflow job for this annotation

GitHub Actions / build

CKV_TF_1: "Ensure Terraform module sources use a commit hash"
source = "cloudposse/ecs-container-definition/aws"
version = "v0.58.1"

Expand Down Expand Up @@ -169,7 +169,7 @@
secrets = var.custom_environment_secrets
}

resource "aws_ecs_task_definition" "app" {

Check failure on line 172 in ecs.tf

View workflow job for this annotation

GitHub Actions / build

CKV_AWS_249: "Ensure that the Execution Role ARN and the Task Role ARN are different in ECS Task definitions"
#checkov:skip=CKV_AWS_97:
family = local.ecs_task_definition_family_name
execution_role_arn = var.create_default_role ? aws_iam_role.ecs_task_execution[0].arn : var.external_iam_role
Expand Down Expand Up @@ -206,5 +206,8 @@
}
}
}

pid_mode = var.datadog_process_collection_enabled ? "task" : null

tags = local.local_tags
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ variable "datadog_service_name" {
default = ""
}

variable "datadog_process_collection_enabled" {
description = "Whether to enable process collection"
type = bool
default = true
}

variable "datadog_tags" {
description = " Tags for datadog agent container."
type = string
Expand Down
Loading