Skip to content

Commit 817f973

Browse files
author
Angel Pizarro
committed
Removed custom AWS Batch service role from the metaflow-computation submodule.
Addresses issue outerbounds#101
1 parent ee7093c commit 817f973

File tree

4 files changed

+18
-195
lines changed

4 files changed

+18
-195
lines changed

modules/computation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ To read more, see [the Metaflow docs](https://docs.metaflow.org/metaflow-on-aws/
2020
| <a name="input_compute_environment_instance_types"></a> [compute\_environment\_instance\_types](#input\_compute\_environment\_instance\_types) | The instance types for the compute environment as a comma-separated list | `list(string)` | n/a | yes |
2121
| <a name="input_compute_environment_max_vcpus"></a> [compute\_environment\_max\_vcpus](#input\_compute\_environment\_max\_vcpus) | Maximum VCPUs for Batch Compute Environment [16-96] | `number` | n/a | yes |
2222
| <a name="input_compute_environment_min_vcpus"></a> [compute\_environment\_min\_vcpus](#input\_compute\_environment\_min\_vcpus) | Minimum VCPUs for Batch Compute Environment [0-16] for EC2 Batch Compute Environment (ignored for Fargate) | `number` | n/a | yes |
23+
| <a name="input_custom_batch_service_role_arn"></a> [custom\_batch\_service\_role\_arn](#input\_custom\_batch\_service\_role\_arn) | The ARN of a custom service role for AWS Batch managed services to leverage. For more information, refer to https://docs.aws.amazon.com/batch/latest/userguide/using-service-linked-roles.html | `string` | `null` | no |
2324
| <a name="input_iam_partition"></a> [iam\_partition](#input\_iam\_partition) | IAM Partition (Select aws-us-gov for AWS GovCloud, otherwise leave as is) | `string` | `"aws"` | no |
2425
| <a name="input_launch_template_http_endpoint"></a> [launch\_template\_http\_endpoint](#input\_launch\_template\_http\_endpoint) | Whether the metadata service is available. Can be 'enabled' or 'disabled' | `string` | `"enabled"` | no |
2526
| <a name="input_launch_template_http_put_response_hop_limit"></a> [launch\_template\_http\_put\_response\_hop\_limit](#input\_launch\_template\_http\_put\_response\_hop\_limit) | The desired HTTP PUT response hop limit for instance metadata requests. Can be an integer from 1 to 64 | `number` | `2` | no |

modules/computation/batch.tf

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@ resource "aws_batch_compute_environment" "this" {
88
*/
99
compute_environment_name_prefix = local.compute_env_prefix_name
1010

11-
# Give permissions so the batch service can make API calls.
12-
service_role = aws_iam_role.batch_execution_role.arn
13-
type = "MANAGED"
14-
15-
# On destroy, this avoids removing these policies below until compute environments are destroyed
16-
depends_on = [
17-
aws_iam_role_policy.grant_iam_pass_role,
18-
aws_iam_role_policy.grant_custom_access_policy,
19-
aws_iam_role_policy.grant_iam_custom_policies,
20-
aws_iam_role_policy.grant_ec2_custom_policies,
21-
]
11+
type = "MANAGED"
2212

2313
compute_resources {
2414
# Give permissions so the ECS container instances can make API call.
@@ -73,6 +63,15 @@ resource "aws_batch_compute_environment" "this" {
7363
# To ensure terraform redeploys do not silently overwrite an up to date desired_vcpus that metaflow may modify
7464
ignore_changes = [compute_resources.0.desired_vcpus]
7565
}
66+
67+
/* Define a custom service role for AWS Batch. Usually this is not
68+
needed, as AWS Batch will create a Service-Linked Role (SLR)
69+
when you create your first compute environment.
70+
71+
For more information, refer to https://docs.aws.amazon.com/batch/latest/userguide/using-service-linked-roles.html.
72+
*/
73+
service_role = var.custom_batch_service_role_arn
74+
7675
}
7776

7877
resource "aws_batch_job_queue" "this" {

modules/computation/iam-batch-execution.tf

Lines changed: 0 additions & 184 deletions
This file was deleted.

modules/computation/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,10 @@ variable "launch_template_image_id" {
102102
nullable = true
103103
default = null
104104
}
105+
106+
variable "custom_batch_service_role_arn" {
107+
type = string
108+
description = "The ARN of a custom service role for AWS Batch managed services to leverage. For more information, refer to https://docs.aws.amazon.com/batch/latest/userguide/using-service-linked-roles.html"
109+
nullable = true
110+
default = null
111+
}

0 commit comments

Comments
 (0)