How to pass multiple bootstrap actions in AWS EMR using Terraform?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to pass multiple bootstrap actions in AWS EMR using Terraform?



I am trying to create a terraform module for AWS EMR cluster. I need to run multiple bootstrap scripts in EMR, where I am having errors.
For example:



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"




I passed all the variables including bootstrap as :


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



When I am applying the plan, I am getting error:


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



Does anyone have any idea on it? How can I pass multiple bootstrap actions here.
Please advise.



Thanks.




2 Answers
2



Doc: bootstrap_action - (Optional) list of bootstrap actions that will be run before Hadoop is started on the cluster nodes.


bootstrap_action



Your variable is list of strings, not list of objects. This variable is probably ok (not tested):


bootstrap_actions = [

path = "s3://bucket/bootstrap/hive/metastore/JSON41.sh"
name = "SERDE"
,

path = "s3://bucket/bootstrap/hive/hive-nofile-nproc-increase.sh"
name = "ulimit"
,
]



It works :


bootstrap_action = [

name = "custombootrstrap_test1"
path = "s3://$aws_s3_bucket.bucketlogs.bucket/bootstrap-actions/master/configure-test1.sh"
,

name = "custombootrstrap_test2"
path = "s3://$aws_s3_bucket.bucketlogs.bucket/bootstrap-actions/master/configure-test2.sh"
,
]






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard