The following code gives me a list of all EC2 instances that are part of my cluster:
data "aws_instances" "emrMaster" {
instance_tags {
Name = "emr-cluster-name"
}
}
But when I try to narrow the list using the AWS generated tag for the master instance, I get the same list.
data "aws_instances" "emrMaster" {
instance_tags {
Name = "emr-cluster-name"
"aws:elasticmapreduce:instance-group-role" = "MASTER"
}
}
If I remove the quotes on the key name, I get a illegal character error due to the colons in the key name.
data "aws_instances" "emrMaster" {
instance_tags {
Name = "emr-cluster-name"
aws:elasticmapreduce:instance-group-role = "MASTER"
}
}
Is there a better way to do this, am I doing something wrong, or have I uncovered a bug in Terraform?
I am using Terraform v0.11.7
I am looking to capture this value so I can build specific cloudwatch alerts for the master instance that are different from the Core instances.