-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Typo fix * EMR Serverless * Storage refactoring * EMR deps
- Loading branch information
Showing
28 changed files
with
409 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ override.tf.json | |
.idea | ||
venv | ||
docker/spark-py/**/*.jar | ||
modules/aws/emr-serverless/resources/dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "emr_server_exec_role_arn" { | ||
value = try(module.emr-job.emr_server_exec_role_arn, "") | ||
description = "ARN of EMR Serverless execution role" | ||
} | ||
|
||
output "emr_serverless_command" { | ||
value = try(module.emr-job.emr_serverless_command, "") | ||
description = "EMR Serverless command to run a sample SeQuiLa job" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
aws-emr-deploy = true | ||
aws-emr-deploy = true | ||
aws-emr-release = "emr-6.7.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# emr | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | | ||
| <a name="provider_external"></a> [external](#provider\_external) | n/a | | ||
| <a name="provider_null"></a> [null](#provider\_null) | n/a | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_emrserverless_application.emr-serverless](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/emrserverless_application) | resource | | ||
| [aws_iam_role.EMRServerlessS3RuntimeRole](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | ||
| [aws_s3_object.pysequila-venv-pack](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_object) | resource | | ||
| [aws_s3_object.sequila-deps](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_object) | resource | | ||
| [null_resource.pysequila-venv-pack](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | ||
| [external_external.dependencies-extract](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/external) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_aws-emr-release"></a> [aws-emr-release](#input\_aws-emr-release) | EMR Serverless release (needs to be >=6.6.0) | `string` | n/a | yes | | ||
| <a name="input_bucket"></a> [bucket](#input\_bucket) | Bucket name for code, dependencies, etc. | `string` | n/a | yes | | ||
| <a name="input_data_files"></a> [data\_files](#input\_data\_files) | Data files to copy to staging bucket | `list(string)` | n/a | yes | | ||
| <a name="input_pysequila_version"></a> [pysequila\_version](#input\_pysequila\_version) | PySeQuiLa version | `string` | n/a | yes | | ||
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | Default security group ids | `list(string)` | n/a | yes | | ||
| <a name="input_sequila_version"></a> [sequila\_version](#input\_sequila\_version) | SeQuiLa version | `string` | n/a | yes | | ||
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of subnets | `list(string)` | n/a | yes | | ||
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_emr_server_exec_role_arn"></a> [emr\_server\_exec\_role\_arn](#output\_emr\_server\_exec\_role\_arn) | ARN of EMR Serverless execution role | | ||
| <a name="output_emr_serverless_command"></a> [emr\_serverless\_command](#output\_emr\_serverless\_command) | EMR Serverless command to run a sample SeQuiLa job | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
locals { | ||
resources_dir = "${path.module}/resources" | ||
jars_dir = "${local.resources_dir}/dependencies" | ||
} | ||
|
||
resource "aws_emrserverless_application" "emr-serverless" { | ||
name = "sequila" | ||
release_label = var.aws-emr-release | ||
type = "spark" | ||
auto_stop_configuration { | ||
enabled = true | ||
idle_timeout_minutes = 5 | ||
} | ||
network_configuration { | ||
subnet_ids = var.subnet_ids | ||
security_group_ids = var.security_group_ids | ||
} | ||
|
||
} | ||
|
||
resource "aws_iam_role" "EMRServerlessS3RuntimeRole" { | ||
name = "sequila-role" | ||
|
||
tags = { | ||
Name = "sequila-role" | ||
} | ||
|
||
assume_role_policy = jsonencode( | ||
{ | ||
Version = "2012-10-17", | ||
Statement = [ | ||
{ | ||
Action = "sts:AssumeRole" | ||
Principal = { | ||
Service = "emr-serverless.amazonaws.com" | ||
} | ||
Effect = "Allow" | ||
} | ||
] | ||
} | ||
) | ||
} | ||
|
||
|
||
|
||
data "external" "dependencies-extract" { | ||
program = ["${local.resources_dir}/jar_extractor.sh", var.pysequila_version, local.resources_dir, local.jars_dir] | ||
|
||
|
||
} | ||
|
||
resource "aws_s3_object" "sequila-deps" { | ||
for_each = toset(split(",", data.external.dependencies-extract.result.jars)) | ||
key = "jars/sequila/${var.sequila_version}/${each.key}" | ||
source = "${local.jars_dir}/${each.key}" | ||
bucket = var.bucket | ||
acl = "public-read" | ||
} | ||
|
||
resource "null_resource" "pysequila-venv-pack" { | ||
provisioner "local-exec" { | ||
command = "${local.resources_dir}/venv_packer.sh ${var.pysequila_version} ${local.resources_dir}" | ||
} | ||
} | ||
|
||
resource "aws_s3_object" "pysequila-venv-pack" { | ||
depends_on = [null_resource.pysequila-venv-pack] | ||
key = "venv/pysequila/pyspark_pysequila-${var.pysequila_version}.tar.gz" | ||
source = "${local.resources_dir}/venv/pyspark_pysequila-${var.pysequila_version}.tar.gz" | ||
bucket = var.bucket | ||
acl = "public-read" | ||
} |
Oops, something went wrong.