Datadog APM is not creating through terraform

65 views Asked by At

Is there a way to create a Datadog APM page via terraform

enter image description here

I do have a file which creates datadog logs

It does create a datadog logs, but can't create the APM page. Do I need to add anything else to my code?

Thank you!

And this is my terraform code:


resource "aws_ecs_task_definition" "datadog" {
  family = "datadog-${var.env}"
  container_definitions = jsonencode([
    {
      "name" : "datadog-agent",
      "image" : "public.ecr.aws/datadog/agent:latest",
      "cpu" : 100,
      "memory" : 512,
      "essential" : true,
      "mountPoints" : [
        {
          "containerPath" : "/var/run/docker.sock",
          "sourceVolume" : "docker_sock",
          "readOnly" : null
        },
        {
          "containerPath" : "/host/sys/fs/cgroup",
          "sourceVolume" : "cgroup",
          "readOnly" : null
        },
        {
          "containerPath" : "/host/proc",
          "sourceVolume" : "proc",
          "readOnly" : null
        }
      ],
      "environment" : [
        {
          "name" : "DD_API_KEY",
          "value" : local.op_secrets["dd_api_key"]
        },
        {
          "name" : "DD_SITE",
          "value" : "datadoghq.com"
        },
        {
          "name" : "DD_LOGS_ENABLED",
          "value" : "true"
        },
        {
          "name" : "DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL",
          "value" : "true"
        },
        {
          "name" : "DD_PROCESS_AGENT_ENABLED",
          "value" : "true"
        },
        {
          "name" : "DD_ECS_COLLECT_RESOURCE_TAGS_EC2",
          "value" : "true"
        },
        {
          "name" : "DD_APM_ENABLED",
          "value" : "true"
        },
        {
          "name" : "DD_APM_NON_LOCAL_TRAFFIC",
          "value" : "true"
        },
        {
          "name" : "DD_LOGS_INJECTION",
          "value" : "true"
        },
        {
          "name" : "DD_TRACE_AGENT_PORT",
          "value" : "8126"
        }

      ]
      "family" : "datadog-agent-task"
    }

  ])
  volume {
    name      = "docker_sock"
    host_path = "/var/run/docker.sock"
  }
  volume {
    name      = "proc"
    host_path = "/proc/"
  }
  volume {
    name      = "cgroup"
    host_path = "/sys/fs/cgroup/"
  }
}

As you see, I have "DD_APM_ENABLED" as 'true', but still cant get datadog APM page to work.

Please help!

0

There are 0 answers