Terraform module that provision EC2 instances (monitored) with node exporter to export metrics to Promehteus server (monitor)
To allow Prometheus Services discovery scrap metrics over monitored instances we need to attached a role with the necesary permissions
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF