How to give different tags for AWS EMR managed master and core node EC2 instances with terraform?

Viewed 110

This is the snippet used to create the cluster

resource "aws_emr_cluster" "emr_cluster" {
  name          = "test"
  release_label = var.cluster_release_label
  applications  = var.applications

  ec2_attributes {
    key_name                          = var.emr_root_user_key_pair_name
    emr_managed_master_security_group = aws_security_group.emr_instance.id
    emr_managed_slave_security_group  = aws_security_group.emr_instance.id
    instance_profile                  = aws_iam_instance_profile.emr_profile.arn
  }

  master_instance_group {
    instance_count = var.master_instance_count
    instance_type  = var.master_instance_type
    ebs_config {
      size                 = var.master_ebs_size
      type                 = "gp2"
      volumes_per_instance = 1
    }
  }

  core_instance_group {
    instance_count = var.core_instance_count
    instance_type  = var.core_instance_type
    ebs_config {
      size                 = var.core_ebs_size
      type                 = "gp2"
      volumes_per_instance = 1
    }
  }

  ebs_root_volume_size = var.ebs_root_volume_size
  service_role         = module.iam_emr_service_role.role_arn
  tags                 = {
     "Name"  = "//Want to give different name here//"
     "type"  = "EMR"
     "group" = "HBase"
  }    
 
}

When I specify the above tags and apply the changes, the name tag is same in both master and core instances... I want to give different names.. How to achieve this?

0 Answers
Related