2017-05-26 1 views
0

Ich versuche ein Terraform-Modul für AWS EMR-Cluster zu erstellen. Ich muss mehrere Bootstrap-Skripts in EMR ausführen, wo ich Fehler habe. Zum Beispiel:Wie können mehrere Bootstrap-Aktionen in AWS EMR mit Terraform übergeben werden?

main.tf

... 
    variable bootstrap_actions { type = "list"} 
    ...  
    resource "aws_emr_cluster" "emr-cluster" { 
    name   = "${var.emr_name}" 

    release_label = "${var.release_label}" 
    applications = "${var.applications}" 

    termination_protection = true 

    ec2_attributes { 
    subnet_id       = "${data.aws_subnet.subnet.id}" 
    emr_managed_master_security_group = "${data.aws_security_group.emr_managed_master_security_group.id}" 
    emr_managed_slave_security_group = "${data.aws_security_group.emr_managed_slave_security_group.id}" 
    service_access_security_group  = "${data.aws_security_group.service_access_security_group.id}" 
    additional_slave_security_groups = "${var.additional_slave_security_groups_id}" 
    instance_profile     = "${var.instance_profile}" 
    key_name       = "${var.key_name}" 
    } 

    master_instance_type = "${var.master_instance_type}" 
    core_instance_type = "${var.core_instance_type}" 
    core_instance_count = "${var.core_instance_count}" 

    tags { 
     BUSINESS_UNIT = "${var.BUSINESS_UNIT}" 
     BUSINESS_REGION = "${var.BUSINESS_REGION}" 
     CLIENT = "${var.CLIENT}" 
     ENVIRONMENT = "${var.env}" 
     PLATFORM = "${var.PLATFORM}" 
     Name = "${var.emr_name}" 
    } 


    bootstrap_action = "${var.bootstrap_actions}" 

    configurations = "test-fixtures/emr_configurations.json" 

    service_role = "${var.service_role}" 
    autoscaling_role = "${var.autoscaling_role}" 

} 

ich die Variablen alle einschließlich Bootstrap geben als:

bootstrap_actions = [ "path=s3://bucket/bootstrap/hive/metastore/JSON41.sh,name=SERDE","path=s3://bucket/bootstrap/hive/hive-nofile-nproc-increase.sh,name=ulimit" ] 

Wenn ich den Plan beantrage, erhalte ich Fehler:

* aws_emr_cluster.emr-cluster: bootstrap_action.0: expected object, got invalid 
* aws_emr_cluster.emr-cluster: bootstrap_action.1: expected object, got invalid 

Hat jemand eine Idee dazu? Wie kann ich hier mehrere Bootstrap-Aktionen übergeben? Bitte beraten.

Danke.

Antwort

0

Doc: bootstrap_action - (Optional) Liste der Bootstrap-Aktionen, die ausgeführt werden, bevor Hadoop auf den Clusterknoten gestartet wird.

Ihre Variable ist eine Liste von Strings, keine Liste von Objekten. Diese Variable ist wahrscheinlich in Ordnung (nicht getestet):

bootstrap_actions = [ 
    { 
    path = "s3://bucket/bootstrap/hive/metastore/JSON41.sh" 
    name = "SERDE" 
    }, 
    { 
    path = "s3://bucket/bootstrap/hive/hive-nofile-nproc-increase.sh" 
    name = "ulimit" 
    }, 
] 
Verwandte Themen