将EIP与AWS emr集群相关联

时间:2016-10-14 13:56:44

标签: amazon-web-services amazon-emr terraform

我试图将弹性IP与emr_cluster的主节点相关联。

我使用terraform自动创建群集。

实际上,在使用terraform函数后,我没有找到有关如何获取主节点ID的任何答案:resource" aws_emr_cluster"

这是我的terraform代码的一部分

## Creation de l'EMR
resource "aws_emr_cluster" "emr_cluster" {
  name          = "${var.cluster_name}"
  release_label = "emr-5.0.0"
  applications  = ["spark","zeppelin"]

  master_instance_type = "${var.master_type_node}"
  core_instance_type   = "${var.core_type_node}"
  core_instance_count  = "${var.number_of_nodes}"

  ec2_attributes {
    # Key pair
    key_name = "keypairemrcluster"
    # Subnet VPC
    subnet_id = "${aws_subnet.main.id}"
    #les security groups
    emr_managed_master_security_group = "${aws_security_group.allow_all.id}"
    emr_managed_slave_security_group  = "${aws_security_group.allow_all.id}"
    # EMR EC2 default Role
    #instance_profile = "${var.instance_profile}"
    instance_profile = "EMR_EC2_DefaultRole"
    }


  service_role = "EMR_DefaultRole"

# S3 bucket to write the log files of the job flow
  log_uri = "s3n://bedatalab/logs"
}

############# Creation eip #########
resource "aws_eip" "emr_eip" {
  vpc = true
}

# Association de l elastic IP au cluster
resource "aws_eip_association" "eip_assoc" {
  instance_id = **"MASTER_NODE_ID" ???????**
  allocation_id = "${aws_eip.emr_eip.id}"
}

感谢您的帮助

0 个答案:

没有答案