Skip to content

Commit 27cadf5

Browse files
committed
merge conflicts
2 parents ca1c4e9 + ad34d3d commit 27cadf5

File tree

16 files changed

+135
-31
lines changed

16 files changed

+135
-31
lines changed

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
# Please look up the latest version from
1616
# https://github.com/amannn/action-semantic-pull-request/releases
17-
- uses: amannn/action-semantic-pull-request@v5.4.0
17+
- uses: amannn/action-semantic-pull-request@v5.5.3
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020
with:

.github/workflows/pre-commit.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
- master
88

99
env:
10-
TERRAFORM_DOCS_VERSION: v0.16.0
11-
TFLINT_VERSION: v0.50.3
10+
TERRAFORM_DOCS_VERSION: v0.19.0
11+
TFLINT_VERSION: v0.53.0
1212

1313
jobs:
1414
collectInputs:
@@ -45,14 +45,14 @@ jobs:
4545

4646
- name: Terraform min/max versions
4747
id: minMax
48-
uses: clowdhaus/terraform-min-max@v1.3.0
48+
uses: clowdhaus/terraform-min-max@v1.3.1
4949
with:
5050
directory: ${{ matrix.directory }}
5151

5252
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
5353
# Run only validate pre-commit check on min version supported
5454
if: ${{ matrix.directory != '.' }}
55-
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
55+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.11.1
5656
with:
5757
terraform-version: ${{ steps.minMax.outputs.minVersion }}
5858
tflint-version: ${{ env.TFLINT_VERSION }}
@@ -61,7 +61,7 @@ jobs:
6161
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
6262
# Run only validate pre-commit check on min version supported
6363
if: ${{ matrix.directory == '.' }}
64-
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
64+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.11.1
6565
with:
6666
terraform-version: ${{ steps.minMax.outputs.minVersion }}
6767
tflint-version: ${{ env.TFLINT_VERSION }}
@@ -88,10 +88,10 @@ jobs:
8888

8989
- name: Terraform min/max versions
9090
id: minMax
91-
uses: clowdhaus/terraform-min-max@v1.3.0
91+
uses: clowdhaus/terraform-min-max@v1.3.1
9292

9393
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
94-
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
94+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.11.1
9595
with:
9696
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
9797
tflint-version: ${{ env.TFLINT_VERSION }}

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.88.4
3+
rev: v1.96.1
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
@@ -21,10 +21,9 @@ repos:
2121
- '--args=--only=terraform_required_providers'
2222
- '--args=--only=terraform_standard_module_structure'
2323
- '--args=--only=terraform_workspace_remote'
24-
- '--args=--only=terraform_unused_required_providers'
2524
- id: terraform_validate
2625
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v4.5.0
26+
rev: v5.0.0
2827
hooks:
2928
- id: check-merge-conflict
3029
- id: end-of-file-fixer

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.3.0](https://github.com/terraform-aws-modules/terraform-aws-emr/compare/v2.2.0...v2.3.0) (2024-09-21)
6+
7+
8+
### Features
9+
10+
* Allow passing in custom instance profile role ([#30](https://github.com/terraform-aws-modules/terraform-aws-emr/issues/30)) ([0712293](https://github.com/terraform-aws-modules/terraform-aws-emr/commit/0712293bce835f099d5bc43e45320bc23eb5eacd))
11+
512
## [2.2.0](https://github.com/terraform-aws-modules/terraform-aws-emr/compare/v2.1.0...v2.2.0) (2024-08-03)
613

714

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
324324
- [Studios](https://github.com/terraform-aws-modules/terraform-aws-emr/tree/master/examples/studio) with either IAM or SSO authentication
325325
- [Virtual cluster](https://github.com/terraform-aws-modules/terraform-aws-emr/tree/master/examples/virtual-cluster) running on Amazon EKS
326326

327-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
327+
<!-- BEGIN_TF_DOCS -->
328328
## Requirements
329329

330330
| Name | Version |
@@ -402,6 +402,7 @@ No modules.
402402
| <a name="input_iam_instance_profile_description"></a> [iam\_instance\_profile\_description](#input\_iam\_instance\_profile\_description) | Description of the EC2 IAM role/instance profile | `string` | `null` | no |
403403
| <a name="input_iam_instance_profile_name"></a> [iam\_instance\_profile\_name](#input\_iam\_instance\_profile\_name) | Name to use on EC2 IAM role/instance profile created | `string` | `null` | no |
404404
| <a name="input_iam_instance_profile_policies"></a> [iam\_instance\_profile\_policies](#input\_iam\_instance\_profile\_policies) | Map of IAM policies to attach to the EC2 IAM role/instance profile | `map(string)` | <pre>{<br/> "AmazonElasticMapReduceforEC2Role": "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"<br/>}</pre> | no |
405+
| <a name="input_iam_instance_profile_role_arn"></a> [iam\_instance\_profile\_role\_arn](#input\_iam\_instance\_profile\_role\_arn) | The ARN of an existing IAM role to use if passing in a custom instance profile and creating a service role | `string` | `null` | no |
405406
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | IAM role path | `string` | `null` | no |
406407
| <a name="input_iam_role_permissions_boundary"></a> [iam\_role\_permissions\_boundary](#input\_iam\_role\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the IAM role | `string` | `null` | no |
407408
| <a name="input_iam_role_tags"></a> [iam\_role\_tags](#input\_iam\_role\_tags) | A map of additional tags to add to the IAM role created | `map(string)` | `{}` | no |
@@ -477,7 +478,7 @@ No modules.
477478
| <a name="output_service_iam_role_arn"></a> [service\_iam\_role\_arn](#output\_service\_iam\_role\_arn) | Service IAM role ARN |
478479
| <a name="output_service_iam_role_name"></a> [service\_iam\_role\_name](#output\_service\_iam\_role\_name) | Service IAM role name |
479480
| <a name="output_service_iam_role_unique_id"></a> [service\_iam\_role\_unique\_id](#output\_service\_iam\_role\_unique\_id) | Stable and unique string identifying the service IAM role |
480-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
481+
<!-- END_TF_DOCS -->
481482

482483
## License
483484

examples/private-cluster/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ terraform apply
2222

2323
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.
2424

25-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
25+
<!-- BEGIN_TF_DOCS -->
2626
## Requirements
2727

2828
| Name | Version |
@@ -52,7 +52,17 @@ Note that this example may create resources which will incur monetary charges on
5252

5353
| Name | Type |
5454
|------|------|
55+
| [aws_iam_instance_profile.custom_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) | resource |
56+
| [aws_iam_role.autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
57+
| [aws_iam_role.custom_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
58+
| [aws_iam_role_policy_attachment.autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
59+
| [aws_iam_role_policy_attachment.emr_for_ec2](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
5560
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
61+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
62+
| [aws_iam_policy_document.assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
63+
| [aws_iam_policy_document.autoscaling](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
64+
| [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 |
5666

5767
## Inputs
5868

@@ -137,6 +147,6 @@ No inputs.
137147
| <a name="output_group_service_iam_role_arn"></a> [group\_service\_iam\_role\_arn](#output\_group\_service\_iam\_role\_arn) | Service IAM role ARN |
138148
| <a name="output_group_service_iam_role_name"></a> [group\_service\_iam\_role\_name](#output\_group\_service\_iam\_role\_name) | Service IAM role name |
139149
| <a name="output_group_service_iam_role_unique_id"></a> [group\_service\_iam\_role\_unique\_id](#output\_group\_service\_iam\_role\_unique\_id) | Stable and unique string identifying the service IAM role |
140-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
150+
<!-- END_TF_DOCS -->
141151

142152
Apache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-emr/blob/master/LICENSE).

examples/private-cluster/main.tf

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ provider "aws" {
44

55
data "aws_availability_zones" "available" {}
66

7+
data "aws_partition" "current" {}
8+
9+
data "aws_caller_identity" "current" {}
10+
11+
data "aws_region" "current" {}
12+
713
locals {
814
name = replace(basename(path.cwd), "-cluster", "")
915
region = "eu-west-1"
@@ -158,7 +164,9 @@ module "emr_instance_fleet" {
158164
module "emr_instance_group" {
159165
source = "../.."
160166

161-
name = "${local.name}-instance-group"
167+
name = "${local.name}-instance-group"
168+
create_iam_instance_profile = false
169+
create_autoscaling_iam_role = false
162170

163171
release_label_filters = {
164172
emr6 = {
@@ -230,8 +238,12 @@ module "emr_instance_group" {
230238
ebs_root_volume_size = 64
231239
ec2_attributes = {
232240
# Instance groups only support one Subnet/AZ
233-
subnet_id = element(module.vpc.private_subnets, 0)
241+
subnet_id = element(module.vpc.private_subnets, 0)
242+
instance_profile = aws_iam_instance_profile.custom_instance_profile.arn
234243
}
244+
iam_instance_profile_role_arn = aws_iam_role.custom_instance_profile.arn
245+
autoscaling_iam_role_arn = aws_iam_role.autoscaling.arn
246+
235247
vpc_id = module.vpc.vpc_id
236248

237249
keep_job_flow_alive_when_no_steps = true
@@ -357,3 +369,70 @@ module "s3_bucket" {
357369

358370
tags = local.tags
359371
}
372+
373+
resource "aws_iam_role" "custom_instance_profile" {
374+
name_prefix = "custom-instance-profile"
375+
assume_role_policy = data.aws_iam_policy_document.assume.json
376+
}
377+
378+
data "aws_iam_policy_document" "assume" {
379+
statement {
380+
actions = ["sts:AssumeRole"]
381+
principals {
382+
identifiers = ["ec2.amazonaws.com"]
383+
type = "Service"
384+
}
385+
}
386+
}
387+
388+
resource "aws_iam_role_policy_attachment" "emr_for_ec2" {
389+
role = aws_iam_role.custom_instance_profile.name
390+
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"
391+
}
392+
393+
resource "aws_iam_instance_profile" "custom_instance_profile" {
394+
role = aws_iam_role.custom_instance_profile.name
395+
396+
name = "custom-instance-profile"
397+
398+
depends_on = [
399+
aws_iam_role_policy_attachment.emr_for_ec2,
400+
]
401+
}
402+
403+
resource "aws_iam_role" "autoscaling" {
404+
name_prefix = "custom-autoscaling-role"
405+
assume_role_policy = data.aws_iam_policy_document.autoscaling.json
406+
}
407+
408+
data "aws_iam_policy_document" "autoscaling" {
409+
statement {
410+
sid = "EMRAssumeRole"
411+
actions = ["sts:AssumeRole"]
412+
413+
principals {
414+
type = "Service"
415+
identifiers = [
416+
"elasticmapreduce.${data.aws_partition.current.dns_suffix}",
417+
"application-autoscaling.${data.aws_partition.current.dns_suffix}"
418+
]
419+
}
420+
421+
condition {
422+
test = "StringEquals"
423+
variable = "aws:SourceAccount"
424+
values = [data.aws_caller_identity.current.account_id]
425+
}
426+
427+
condition {
428+
test = "ArnLike"
429+
variable = "aws:SourceArn"
430+
values = ["arn:aws:elasticmapreduce:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"]
431+
}
432+
}
433+
}
434+
435+
resource "aws_iam_role_policy_attachment" "autoscaling" {
436+
role = aws_iam_role.autoscaling.name
437+
policy_arn = "arn:${data.aws_partition.current.partition}:iam::aws:policy/service-role/AmazonElasticMapReduceforAutoScalingRole"
438+
}

examples/public-cluster/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $ terraform apply
2020

2121
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.
2222

23-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
23+
<!-- BEGIN_TF_DOCS -->
2424
## Requirements
2525

2626
| Name | Version |
@@ -107,6 +107,6 @@ No inputs.
107107
| <a name="output_group_service_iam_role_arn"></a> [group\_service\_iam\_role\_arn](#output\_group\_service\_iam\_role\_arn) | Service IAM role ARN |
108108
| <a name="output_group_service_iam_role_name"></a> [group\_service\_iam\_role\_name](#output\_group\_service\_iam\_role\_name) | Service IAM role name |
109109
| <a name="output_group_service_iam_role_unique_id"></a> [group\_service\_iam\_role\_unique\_id](#output\_group\_service\_iam\_role\_unique\_id) | Stable and unique string identifying the service IAM role |
110-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
110+
<!-- END_TF_DOCS -->
111111

112112
Apache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-emr/blob/master/LICENSE).

examples/serverless-cluster/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $ terraform apply
2020

2121
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.
2222

23-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
23+
<!-- BEGIN_TF_DOCS -->
2424
## Requirements
2525

2626
| Name | Version |
@@ -69,6 +69,6 @@ No inputs.
6969
| <a name="output_spark_id"></a> [spark\_id](#output\_spark\_id) | ID of the application |
7070
| <a name="output_spark_security_group_arn"></a> [spark\_security\_group\_arn](#output\_spark\_security\_group\_arn) | Amazon Resource Name (ARN) of the security group |
7171
| <a name="output_spark_security_group_id"></a> [spark\_security\_group\_id](#output\_spark\_security\_group\_id) | ID of the security group |
72-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
72+
<!-- END_TF_DOCS -->
7373

7474
Apache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-emr/blob/master/LICENSE).

examples/studio/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $ terraform plan
1616
$ terraform apply
1717
```
1818

19-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
19+
<!-- BEGIN_TF_DOCS -->
2020
## Requirements
2121

2222
| Name | Version |
@@ -114,6 +114,6 @@ No inputs.
114114
| <a name="output_sso_user_iam_role_unique_id"></a> [sso\_user\_iam\_role\_unique\_id](#output\_sso\_user\_iam\_role\_unique\_id) | Stable and unique string identifying the user IAM role |
115115
| <a name="output_sso_workspace_security_group_arn"></a> [sso\_workspace\_security\_group\_arn](#output\_sso\_workspace\_security\_group\_arn) | Amazon Resource Name (ARN) of the workspace security group |
116116
| <a name="output_sso_workspace_security_group_id"></a> [sso\_workspace\_security\_group\_id](#output\_sso\_workspace\_security\_group\_id) | ID of the workspace security group |
117-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
117+
<!-- END_TF_DOCS -->
118118

119119
Apache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-emr/blob/master/LICENSE).

0 commit comments

Comments
 (0)