Skip to content

Latest commit

 

History

History
103 lines (79 loc) · 9.02 KB

README.md

File metadata and controls

103 lines (79 loc) · 9.02 KB

Grafana Cloud Agent for ECS

Terraform module which integrate Grafana Agent into existent ECS Cluster

Usage

module "grafana_agent" {

  source  = "xente/ecs-grafana-agent/aws"
  version = "0.1.0"
  
  name = "my-grafana-agent"
  ecs_cluster_id = aws_ecs_cluster.current.id
  grafana_credentials_username  = "MY_USER"
  grafana_credentials_password = "MY_PASSWORD"
  vpc_subnets =  [aws_subnet.main.id]
}


resource "aws_ecs_cluster" "sample" {
  name = "${local.stack}-sample"
}

resource "aws_ecs_cluster_capacity_providers" "sample" {
  cluster_name       = aws_ecs_cluster.sample.name
  capacity_providers = [module.grafana_agent.ecs_agent_capacity_provider_name]
}

Requirements

Name Version
terraform >= 1.0.0
aws >= 3.73

Providers

Name Version
aws >= 3.73

Modules

No modules.

Resources

Name Type
aws_autoscaling_group.this resource
aws_ecs_capacity_provider.this resource
aws_ecs_service.agent resource
aws_ecs_service.cadvisor_node_exporter resource
aws_ecs_task_definition.cadvisor_node_exporter resource
aws_ecs_task_definition.grafana_agent resource
aws_iam_instance_profile.ecs_instance_profile resource
aws_iam_role.ecs_instance resource
aws_iam_role.grafana_agent_execution_role resource
aws_iam_role.grafana_agent_task_role resource
aws_launch_template.this resource
aws_s3_bucket.resources resource
aws_s3_object.agent_config resource
aws_ami.amazon_linux_ecs data source
aws_iam_policy_document.ec2_assume_role data source
aws_iam_policy_document.grafana_agent_discovery data source
aws_iam_policy_document.grafana_agent_tasks_execution_role data source
aws_iam_policy_document.s3_resources_access data source
aws_partition.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
ecs_cluster_id Id of the ECS cluster where Agent has to be deployed string n/a yes
grafana_credentials_password Grafanan credentials string n/a yes
grafana_credentials_username Grafana username string n/a yes
name Name to be used on all the resources as identifier string n/a yes
vpc_subnets (Required) List of one or more availability subnets where Grafana Agent ASG has to allocate the instances list(string) n/a yes
agent_service_desired_count (Optional) Desired agent service replicas number 1 no
asg_agent_capacity (Optional) Capacity of the ASG for the agent map(number)
{
"desired_capacity": 1,
"max_size": 1,
"min_size": 1
}
no
cadvisor_docker_image (Optional) Cadvisor Docker image string "google/cadvisor" no
grafana_agent_docker_image (Optional) Grafana Agent Docker image string "grafana/agent" no
grafana_agent_keep_label_regex (Optional) Filter out targets and metrics based on whether our label values match the provided regex. string `"node_disk_bytes_read node_cpu_utilisation
grafana_credentials_push_url Remote Prometheus Write Endpoint string "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push" no
launch_instance_type_agent (Optional) Instance type to use for the instance string "t3.small" no
node_exporter_docker_image (Optional) Node Exporter Docker image string "node-exporter" no
protect_from_scale_in (Optional) Whether newly launched instances are automatically protected from termination by Amazon EC2 Auto Scaling when scaling in. bool true no

Outputs

Name Description
ecs_agent_capacity_provider_name Capacity provider to be added into ECS cluster
ecs_agent_service_name Grafana ECS services name