From f0a630cc2a0f06ae6cb25b6914e339673e8ef358 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 10:57:30 +0900 Subject: [PATCH 1/4] sfn-manage-batch-job-tf: Update AWS Provider to v6 --- sfn-manage-batch-job-tf/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfn-manage-batch-job-tf/main.tf b/sfn-manage-batch-job-tf/main.tf index 3a2ae45982..ab1c19f53b 100644 --- a/sfn-manage-batch-job-tf/main.tf +++ b/sfn-manage-batch-job-tf/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~>4.0" + version = "~> 6.0" } } } From c9107bd8f2cc17cdc55d476971276e0cee3de7f0 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 11:05:33 +0900 Subject: [PATCH 2/4] sfn-manage-batch-job-tf: Fix deprecated managed_policy_arns argument --- sfn-manage-batch-job-tf/main.tf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sfn-manage-batch-job-tf/main.tf b/sfn-manage-batch-job-tf/main.tf index ab1c19f53b..e9ef237188 100644 --- a/sfn-manage-batch-job-tf/main.tf +++ b/sfn-manage-batch-job-tf/main.tf @@ -218,7 +218,11 @@ resource "aws_iam_role" "batch_role" { }, ] }) - managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole"] +} + +resource "aws_iam_role_policy_attachment" "batch_role" { + role = aws_iam_role.batch_role.name + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole" } #Create the ECS instance role @@ -236,7 +240,11 @@ resource "aws_iam_role" "batch_ecs_role" { }, ] }) - managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"] +} + +resource "aws_iam_role_policy_attachment" "batch_ecs_role" { + role = aws_iam_role.batch_ecs_role.name + policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" } # Create the ECS instance profile @@ -264,10 +272,10 @@ resource "aws_batch_compute_environment" "batch_compute_env" { ] } depends_on = [ - aws_iam_role.batch_ecs_role, + aws_iam_role_policy_attachment.batch_ecs_role, aws_subnet.subnet, aws_security_group.batch_sg, - aws_iam_role.batch_role + aws_iam_role_policy_attachment.batch_role ] } From 5652f6052d9e1aafb29499c800641fe9cc16cb28 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 11:12:50 +0900 Subject: [PATCH 3/4] sfn-manage-batch-job-tf: Fix deprecated aws_batch resource attribute --- sfn-manage-batch-job-tf/main.tf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sfn-manage-batch-job-tf/main.tf b/sfn-manage-batch-job-tf/main.tf index e9ef237188..cdd843f790 100644 --- a/sfn-manage-batch-job-tf/main.tf +++ b/sfn-manage-batch-job-tf/main.tf @@ -254,7 +254,7 @@ resource "aws_iam_instance_profile" "ecs_profile" { } resource "aws_batch_compute_environment" "batch_compute_env" { - compute_environment_name = "BatchComputeEnvironment-${random_string.random.result}" + name = "BatchComputeEnvironment-${random_string.random.result}" type = "MANAGED" service_role = aws_iam_role.batch_role.arn compute_resources { @@ -283,9 +283,10 @@ resource "aws_batch_job_queue" "batch_job_queue" { name = "StepFunctions-BatchJobManagementQueue-${random_string.random.result}" state = "ENABLED" priority = 1 - compute_environments = [ - aws_batch_compute_environment.batch_compute_env.arn - ] + compute_environment_order { + order = 1 + compute_environment = aws_batch_compute_environment.batch_compute_env.arn + } } resource "aws_iam_role" "sfn_batch_job_role" { From 017d10a0fdc5f1f9938872d694534acac3d6081b Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 9 Aug 2026 11:25:55 +0900 Subject: [PATCH 4/4] sfn-manage-batch-job-tf: Fix README --- sfn-manage-batch-job-tf/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sfn-manage-batch-job-tf/README.md b/sfn-manage-batch-job-tf/README.md index f2b97a7a7c..88fce5e513 100644 --- a/sfn-manage-batch-job-tf/README.md +++ b/sfn-manage-batch-job-tf/README.md @@ -1,10 +1,10 @@ # Manage a Batch Job -This workflow use Step Functions, AWS Batch and AWS SNS Topics to start an batch job and send a notification with the status of the job execution via SNS. This sample project creates the following: +This workflow use Step Functions, AWS Batch and Amazon SNS Topics to start an batch job and send a notification with the status of the job execution via SNS. This sample project creates the following: * An AWS Batch job * An Amazon SNS topic -* AWS Step Function +* AWS Step Functions * Related AWS Identity and Access Management (IAM) roles Learn more about this workflow at Step Functions workflows collection: https://docs.aws.amazon.com/step-functions/latest/dg/batch-job-notification.html @@ -16,7 +16,7 @@ Important: this application uses various AWS services and there are costs associ * [Create an AWS account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources. * [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured * [Git Installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -* [AWS Serverless Application Model](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) (AWS SAM) installed +* [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) with version 1.x installed (this pattern has been tested with version 1.15) ## Deployment Instructions