Skip to content

Commit

Permalink
Include Steps option in aws_emr_cluster (#30)
Browse files Browse the repository at this point in the history
* Updating for issue number 7 so that we can include steps in the emr
cluster

* Executed 'terraform fmt'

* Updated README.md

Co-authored-by: Hannah Amundson <amundson.hannah@heb.com>
Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 14, 2020
1 parent c98b670 commit a207856
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ Available targets:
| slave\_allowed\_security\_groups | List of security groups to be allowed to connect to the slave instances | `list(string)` | `[]` | no |
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| step\_concurrency\_level | The number of steps that can be executed concurrently. You can specify a maximum of 256 steps. Only valid for EMR clusters with release\_label 5.28.0 or greater. | `number` | `null` | no |
| steps | List of steps to run when creating the cluster. | <pre>list(object({<br> name = string<br> action_on_failure = string<br> hadoop_jar_step = object({<br> args = list(string)<br> jar = string<br> main_class = string<br> properties = map(string)<br> })<br> }))</pre> | `[]` | no |
| subnet\_id | VPC subnet ID where you want the job flow to launch. Cannot specify the `cc1.4xlarge` instance type for nodes of a job flow launched in a Amazon VPC | `string` | n/a | yes |
| subnet\_type | Type of VPC subnet ID where you want the job flow to launch. Supported values are `private` or `public` | `string` | `"private"` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
| slave\_allowed\_security\_groups | List of security groups to be allowed to connect to the slave instances | `list(string)` | `[]` | no |
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| step\_concurrency\_level | The number of steps that can be executed concurrently. You can specify a maximum of 256 steps. Only valid for EMR clusters with release\_label 5.28.0 or greater. | `number` | `null` | no |
| steps | List of steps to run when creating the cluster. | <pre>list(object({<br> name = string<br> action_on_failure = string<br> hadoop_jar_step = object({<br> args = list(string)<br> jar = string<br> main_class = string<br> properties = map(string)<br> })<br> }))</pre> | `[]` | no |
| subnet\_id | VPC subnet ID where you want the job flow to launch. Cannot specify the `cc1.4xlarge` instance type for nodes of a job flow launched in a Amazon VPC | `string` | n/a | yes |
| subnet\_type | Type of VPC subnet ID where you want the job flow to launch. Supported values are `private` or `public` | `string` | `"private"` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
Expand Down
14 changes: 14 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,20 @@ resource "aws_emr_cluster" "default" {
}
}

dynamic "step" {
for_each = var.steps
content {
name = step.value.name
action_on_failure = step.value.action_on_failure
hadoop_jar_step {
jar = step.value.hadoop_jar_step["jar"]
main_class = lookup(step.value.hadoop_jar_step, "main_class", null)
properties = lookup(step.value.hadoop_jar_step, "properties", null)
args = lookup(step.value.hadoop_jar_step, "args", null)
}
}
}

configurations_json = var.configurations_json

log_uri = var.log_uri
Expand Down
15 changes: 15 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,18 @@ variable "kerberos_realm" {
description = "The name of the Kerberos realm to which all nodes in a cluster belong. For example, EC2.INTERNAL"
default = "EC2.INTERNAL"
}

variable "steps" {
type = list(object({
name = string
action_on_failure = string
hadoop_jar_step = object({
args = list(string)
jar = string
main_class = string
properties = map(string)
})
}))
description = "List of steps to run when creating the cluster."
default = []
}

0 comments on commit a207856

Please sign in to comment.