Skip to content

Commit abd4b1f

Browse files
committed
fix: Update module versions and example to latest to resolve errors
1 parent bd9bde0 commit abd4b1f

File tree

14 files changed

+66
-160
lines changed

14 files changed

+66
-160
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Terraform module which creates AWS EMR resources.
55
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
66

77
This module supports the creation of:
8+
89
- EMR clusters using instance fleets or instance groups deployed in public or private subnets
910
- EMR Virtual clusters that run on Amazon EKS
1011
- EMR Serverless clusters
@@ -13,7 +14,8 @@ This module supports the creation of:
1314
- Security group for EMR `service` to support private clusters
1415
- IAM roles for autoscaling, EMR `service`, and EC2 instance profiles
1516

16-
:information_source: The appropriate resources have been tagged with `{ "for-use-with-amazon-emr-managed-policies" = true }` to support the use of the recommended IAM policy `"arn:aws:iam::aws:policy/service-role/AmazonEMRServicePolicy_v2"`. Users are required to tag the appropriate VPC resources (VPC and subnets) as needed. See [here](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-iam-policies.html) for more details regarding v2 of managed EMR policies and their usage requirements.
17+
> [!IMPORTANT]
18+
> The appropriate resources have been tagged with `{ "for-use-with-amazon-emr-managed-policies" = true }` to support the use of the recommended IAM policy `"arn:aws:iam::aws:policy/service-role/AmazonEMRServicePolicy_v2"`. Users are required to tag the appropriate VPC resources (VPC and subnets) as needed. See [here](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-iam-policies.html) for more details regarding v2 of managed EMR policies and their usage requirements.
1719
1820
## Usage
1921

examples/private-cluster/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ Note that this example may create resources which will incur monetary charges on
4343
| <a name="module_emr_disabled"></a> [emr\_disabled](#module\_emr\_disabled) | ../.. | n/a |
4444
| <a name="module_emr_instance_fleet"></a> [emr\_instance\_fleet](#module\_emr\_instance\_fleet) | ../.. | n/a |
4545
| <a name="module_emr_instance_group"></a> [emr\_instance\_group](#module\_emr\_instance\_group) | ../.. | n/a |
46-
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
47-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
48-
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | terraform-aws-modules/vpc/aws//modules/vpc-endpoints | ~> 5.0 |
46+
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 |
47+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
48+
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | terraform-aws-modules/vpc/aws//modules/vpc-endpoints | ~> 6.0 |
4949
| <a name="module_vpc_endpoints_sg"></a> [vpc\_endpoints\_sg](#module\_vpc\_endpoints\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
5050

5151
## Resources
@@ -62,7 +62,6 @@ Note that this example may create resources which will incur monetary charges on
6262
| [aws_iam_policy_document.assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6363
| [aws_iam_policy_document.autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6464
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
65-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
6665

6766
## Inputs
6867

examples/private-cluster/main.tf

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ provider "aws" {
33
}
44

55
data "aws_availability_zones" "available" {}
6-
76
data "aws_partition" "current" {}
8-
97
data "aws_caller_identity" "current" {}
108

11-
data "aws_region" "current" {}
12-
139
locals {
1410
name = replace(basename(path.cwd), "-cluster", "")
1511
region = "eu-west-1"
@@ -270,7 +266,7 @@ module "emr_disabled" {
270266

271267
module "vpc" {
272268
source = "terraform-aws-modules/vpc/aws"
273-
version = "~> 5.0"
269+
version = "~> 6.0"
274270

275271
name = local.name
276272
cidr = local.vpc_cidr
@@ -294,7 +290,7 @@ module "vpc" {
294290

295291
module "vpc_endpoints" {
296292
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
297-
version = "~> 5.0"
293+
version = "~> 6.0"
298294

299295
vpc_id = module.vpc.vpc_id
300296
security_group_ids = [module.vpc_endpoints_sg.security_group_id]
@@ -343,7 +339,7 @@ module "vpc_endpoints_sg" {
343339

344340
module "s3_bucket" {
345341
source = "terraform-aws-modules/s3-bucket/aws"
346-
version = "~> 4.0"
342+
version = "~> 5.0"
347343

348344
bucket_prefix = "${local.name}-"
349345

@@ -354,11 +350,6 @@ module "s3_bucket" {
354350
attach_deny_insecure_transport_policy = true
355351
attach_require_latest_tls_policy = true
356352

357-
block_public_acls = true
358-
block_public_policy = true
359-
ignore_public_acls = true
360-
restrict_public_buckets = true
361-
362353
server_side_encryption_configuration = {
363354
rule = {
364355
apply_server_side_encryption_by_default = {
@@ -427,7 +418,7 @@ data "aws_iam_policy_document" "autoscaling" {
427418
condition {
428419
test = "ArnLike"
429420
variable = "aws:SourceArn"
430-
values = ["arn:aws:elasticmapreduce:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"]
421+
values = ["arn:aws:elasticmapreduce:${local.region}:${data.aws_caller_identity.current.account_id}:*"]
431422
}
432423
}
433424
}

examples/public-cluster/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Note that this example may create resources which will incur monetary charges on
4040
|------|--------|---------|
4141
| <a name="module_emr_instance_fleet"></a> [emr\_instance\_fleet](#module\_emr\_instance\_fleet) | ../.. | n/a |
4242
| <a name="module_emr_instance_group"></a> [emr\_instance\_group](#module\_emr\_instance\_group) | ../.. | n/a |
43-
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
44-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
43+
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 |
44+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
4545

4646
## Resources
4747

examples/public-cluster/main.tf

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module "emr_instance_group" {
247247

248248
module "vpc" {
249249
source = "terraform-aws-modules/vpc/aws"
250-
version = "~> 5.0"
250+
version = "~> 6.0"
251251

252252
name = local.name
253253
cidr = local.vpc_cidr
@@ -270,7 +270,7 @@ module "vpc" {
270270

271271
module "s3_bucket" {
272272
source = "terraform-aws-modules/s3-bucket/aws"
273-
version = "~> 4.0"
273+
version = "~> 5.0"
274274

275275
bucket_prefix = "${local.name}-"
276276

@@ -281,11 +281,6 @@ module "s3_bucket" {
281281
attach_deny_insecure_transport_policy = true
282282
attach_require_latest_tls_policy = true
283283

284-
block_public_acls = true
285-
block_public_policy = true
286-
ignore_public_acls = true
287-
restrict_public_buckets = true
288-
289284
server_side_encryption_configuration = {
290285
rule = {
291286
apply_server_side_encryption_by_default = {

examples/serverless-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Note that this example may create resources which will incur monetary charges on
4141
| <a name="module_emr_serverless_disabled"></a> [emr\_serverless\_disabled](#module\_emr\_serverless\_disabled) | ../../modules/serverless | n/a |
4242
| <a name="module_emr_serverless_hive"></a> [emr\_serverless\_hive](#module\_emr\_serverless\_hive) | ../../modules/serverless | n/a |
4343
| <a name="module_emr_serverless_spark"></a> [emr\_serverless\_spark](#module\_emr\_serverless\_spark) | ../../modules/serverless | n/a |
44-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
44+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
4545

4646
## Resources
4747

examples/serverless-cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ module "emr_serverless_disabled" {
137137

138138
module "vpc" {
139139
source = "terraform-aws-modules/vpc/aws"
140-
version = "~> 5.0"
140+
version = "~> 6.0"
141141

142142
name = local.name
143143
cidr = local.vpc_cidr

examples/studio/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ $ terraform apply
3838
| <a name="module_emr_studio_disabled"></a> [emr\_studio\_disabled](#module\_emr\_studio\_disabled) | ../../modules/studio | n/a |
3939
| <a name="module_emr_studio_iam"></a> [emr\_studio\_iam](#module\_emr\_studio\_iam) | ../../modules/studio | n/a |
4040
| <a name="module_emr_studio_sso"></a> [emr\_studio\_sso](#module\_emr\_studio\_sso) | ../../modules/studio | n/a |
41-
| <a name="module_kms"></a> [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 2.0 |
42-
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
43-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
41+
| <a name="module_kms"></a> [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 4.0 |
42+
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 |
43+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
4444

4545
## Resources
4646

@@ -49,7 +49,6 @@ $ terraform apply
4949
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
5050
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
5151
| [aws_identitystore_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/identitystore_group) | data source |
52-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
5352
| [aws_ssoadmin_instances.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssoadmin_instances) | data source |
5453

5554
## Inputs

examples/studio/main.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ provider "aws" {
33
}
44

55
data "aws_availability_zones" "available" {}
6-
76
data "aws_caller_identity" "current" {}
87

9-
data "aws_region" "current" {}
10-
118
locals {
129
name = replace(basename(path.cwd), "-cluster", "")
1310
region = "eu-west-1"
@@ -174,7 +171,7 @@ module "emr_studio_disabled" {
174171

175172
module "vpc" {
176173
source = "terraform-aws-modules/vpc/aws"
177-
version = "~> 5.0"
174+
version = "~> 6.0"
178175

179176
name = local.name
180177
cidr = local.vpc_cidr
@@ -192,7 +189,7 @@ module "vpc" {
192189

193190
module "s3_bucket" {
194191
source = "terraform-aws-modules/s3-bucket/aws"
195-
version = "~> 4.0"
192+
version = "~> 5.0"
196193

197194
bucket_prefix = "${local.name}-"
198195

@@ -221,7 +218,7 @@ module "s3_bucket" {
221218

222219
module "kms" {
223220
source = "terraform-aws-modules/kms/aws"
224-
version = "~> 2.0"
221+
version = "~> 4.0"
225222

226223
deletion_window_in_days = 7
227224
description = "KMS key for ${local.name}."
@@ -262,7 +259,7 @@ module "kms" {
262259
{
263260
test = "StringEquals"
264261
variable = "kms:ViaService"
265-
values = ["s3.${data.aws_region.current.name}.amazonaws.com"]
262+
values = ["s3.${local.region}.amazonaws.com"]
266263
}
267264
]
268265
}

examples/virtual-cluster/README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# AWS EMR Virtual Cluster Example
22

3-
This example shows how to provision a serverless cluster (serverless data plane) using Fargate Profiles to support EMR on EKS virtual clusters.
4-
5-
There are two Fargate profiles created:
6-
1. `kube-system` to support core Kubernetes components such as CoreDNS
7-
2. `emr-wildcard` which supports any namespaces that begin with `emr-*`; this allows for creating multiple virtual clusters without having to create additional Fargate profiles for each new cluster.
3+
This example shows how to provision a serverless cluster (serverless data plane) using EKS Auto Mode to support EMR on EKS virtual clusters.
84

95
The resources created by the `virtual-cluster` module include:
6+
107
- Kubernetes namespace, role, and role binding; existing or externally created namespace and role can be utilized as well
11-
- IAM role for service account (IRSA) used by for job execution. Users can scope access to the appropriate S3 bucket and path via `s3_bucket_arns`, use for both accessing job data as well as writing out results. The bare minimum permissions have been provided for the job execution role; users can provide additional permissions by passing in additional policies to attach to the role via `iam_role_additional_policies`
128
- CloudWatch log group for task execution logs. Log streams are created by the job itself and not via Terraform
139
- EMR managed security group for the virtual cluster
1410
- EMR virtual cluster scoped to the namespace created/provided
@@ -18,9 +14,9 @@ The resources created by the `virtual-cluster` module include:
1814
To run this example you need to execute:
1915

2016
```bash
21-
$ terraform init
22-
$ terraform plan
23-
$ terraform apply
17+
terraform init
18+
terraform plan
19+
terraform apply
2420
```
2521

2622
Note that this example may create resources which will incur monetary charges on your AWS bill. Run `terraform destroy` when you no longer need these resources.
@@ -56,7 +52,6 @@ aws emr-containers list-virtual-clusters --region us-west-2 --states ARRESTED \
5652
|------|---------|
5753
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.83 |
5854
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.0 |
59-
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |
6055

6156
## Modules
6257

@@ -65,10 +60,10 @@ aws emr-containers list-virtual-clusters --region us-west-2 --states ARRESTED \
6560
| <a name="module_complete"></a> [complete](#module\_complete) | ../../modules/virtual-cluster | n/a |
6661
| <a name="module_default"></a> [default](#module\_default) | ../../modules/virtual-cluster | n/a |
6762
| <a name="module_disabled"></a> [disabled](#module\_disabled) | ../../modules/virtual-cluster | n/a |
68-
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 19.13 |
69-
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
70-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
71-
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | terraform-aws-modules/vpc/aws//modules/vpc-endpoints | ~> 5.0 |
63+
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 21.0 |
64+
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 |
65+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
66+
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | terraform-aws-modules/vpc/aws//modules/vpc-endpoints | ~> 6.0 |
7267
| <a name="module_vpc_endpoints_sg"></a> [vpc\_endpoints\_sg](#module\_vpc\_endpoints\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
7368

7469
## Resources
@@ -77,9 +72,7 @@ aws emr-containers list-virtual-clusters --region us-west-2 --states ARRESTED \
7772
|------|------|
7873
| [null_resource.s3_sync](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
7974
| [null_resource.start_job_run](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
80-
| [time_sleep.coredns](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
8175
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
82-
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
8376

8477
## Inputs
8578

0 commit comments

Comments
 (0)