Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[36384] Add job state time limit actions to batch queue #38784

Merged
merged 11 commits into from
Aug 16, 2024

Conversation

ChannyClaus
Copy link
Contributor

@ChannyClaus ChannyClaus commented Aug 9, 2024

Picking up #36658

Description

A new option has been added to batch job queues: https://aws.amazon.com/about-aws/whats-new/2024/03/aws-batch-alerts-detect-jobs-runnable-state/

This PR just adds support for the new API fields to the batch queue terraform resource.

Relations

Closes #36384

References

API reference: https://docs.aws.amazon.com/batch/latest/APIReference/API_JobStateTimeLimitAction.html

Output from Acceptance Testing

tested with

terraform {
  required_providers {
	aws = {
      source  = "terraform.local/local/aws"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-west-2"
}


resource "aws_batch_compute_environment" "sample" {
  compute_environment_name = "sample"

  compute_resources {
    max_vcpus = 16
    subnets = [
      "<redacted>",
    ] 
    security_group_ids = [
      "<redacted>",
    ]
    type = "FARGATE"
  }

  type         = "MANAGED"
}

resource "aws_batch_job_queue" "test_queue" {
  name     = "tf-test-batch-job-queue4"
  state    = "ENABLED"
  priority = 1
  compute_environment_order {
    order               = 1
    compute_environment = aws_batch_compute_environment.sample.arn
  }
  job_state_time_limit_action {
    action           = "CANCEL"
    max_time_seconds = 606
    reason           = "CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY"
    state            = "RUNNABLE"
  }
}

@ChannyClaus ChannyClaus requested a review from a team as a code owner August 9, 2024 05:28
Copy link

github-actions bot commented Aug 9, 2024

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/batch Issues and PRs that pertain to the batch service. needs-triage Waiting for first response or review from a maintainer. labels Aug 9, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @ChannyClaus 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 12, 2024
@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Aug 12, 2024
@ewbankkit ewbankkit self-assigned this Aug 16, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 16, 2024
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccBatchJobQueue_\|TestAccBatchJobQueueDataSource_' PKG=batch ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/batch/... -v -count 1 -parallel 3  -run=TestAccBatchJobQueue_\|TestAccBatchJobQueueDataSource_ -timeout 360m
=== RUN   TestAccBatchJobQueueDataSource_tags
=== PAUSE TestAccBatchJobQueueDataSource_tags
=== RUN   TestAccBatchJobQueueDataSource_basic
=== PAUSE TestAccBatchJobQueueDataSource_basic
=== RUN   TestAccBatchJobQueueDataSource_schedulingPolicy
=== PAUSE TestAccBatchJobQueueDataSource_schedulingPolicy
=== RUN   TestAccBatchJobQueue_tags
=== PAUSE TestAccBatchJobQueue_tags
=== RUN   TestAccBatchJobQueue_tags_null
    job_queue_tags_gen_test.go:192: Tags with null values are not correctly handled with the Plugin Framework
--- SKIP: TestAccBatchJobQueue_tags_null (0.00s)
=== RUN   TestAccBatchJobQueue_tags_AddOnUpdate
=== PAUSE TestAccBatchJobQueue_tags_AddOnUpdate
=== RUN   TestAccBatchJobQueue_tags_EmptyTag_OnCreate
=== PAUSE TestAccBatchJobQueue_tags_EmptyTag_OnCreate
=== RUN   TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Add
=== PAUSE TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Add
=== RUN   TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Replace
=== PAUSE TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Replace
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_providerOnly
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_providerOnly
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_nonOverlapping
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_overlapping
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_overlapping
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_emptyResourceTag
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_emptyResourceTag
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_emptyProviderOnlyTag
=== PAUSE TestAccBatchJobQueue_tags_DefaultTags_emptyProviderOnlyTag
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_nullOverlappingResourceTag
    job_queue_tags_gen_test.go:1448: Tags with null values are not correctly handled with the Plugin Framework
--- SKIP: TestAccBatchJobQueue_tags_DefaultTags_nullOverlappingResourceTag (0.00s)
=== RUN   TestAccBatchJobQueue_tags_DefaultTags_nullNonOverlappingResourceTag
    job_queue_tags_gen_test.go:1512: Tags with null values are not correctly handled with the Plugin Framework
--- SKIP: TestAccBatchJobQueue_tags_DefaultTags_nullNonOverlappingResourceTag (0.00s)
=== RUN   TestAccBatchJobQueue_tags_ComputedTag_OnCreate
=== PAUSE TestAccBatchJobQueue_tags_ComputedTag_OnCreate
=== RUN   TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccBatchJobQueue_basic
=== PAUSE TestAccBatchJobQueue_basic
=== RUN   TestAccBatchJobQueue_basicCEO
=== PAUSE TestAccBatchJobQueue_basicCEO
=== RUN   TestAccBatchJobQueue_disappears
=== PAUSE TestAccBatchJobQueue_disappears
=== RUN   TestAccBatchJobQueue_disappearsCEO
=== PAUSE TestAccBatchJobQueue_disappearsCEO
=== RUN   TestAccBatchJobQueue_MigrateFromPluginSDK
=== PAUSE TestAccBatchJobQueue_MigrateFromPluginSDK
=== RUN   TestAccBatchJobQueue_ComputeEnvironments_multiple
=== PAUSE TestAccBatchJobQueue_ComputeEnvironments_multiple
=== RUN   TestAccBatchJobQueue_ComputeEnvironmentOrder_multiple
=== PAUSE TestAccBatchJobQueue_ComputeEnvironmentOrder_multiple
=== RUN   TestAccBatchJobQueue_ComputeEnvironments_externalOrderUpdate
=== PAUSE TestAccBatchJobQueue_ComputeEnvironments_externalOrderUpdate
=== RUN   TestAccBatchJobQueue_priority
=== PAUSE TestAccBatchJobQueue_priority
=== RUN   TestAccBatchJobQueue_schedulingPolicy
=== PAUSE TestAccBatchJobQueue_schedulingPolicy
=== RUN   TestAccBatchJobQueue_state
=== PAUSE TestAccBatchJobQueue_state
=== RUN   TestAccBatchJobQueue_jobStateTimeLimitActionsMultiple
=== PAUSE TestAccBatchJobQueue_jobStateTimeLimitActionsMultiple
=== CONT  TestAccBatchJobQueueDataSource_tags
=== CONT  TestAccBatchJobQueue_tags_ComputedTag_OnCreate
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_providerOnly
--- PASS: TestAccBatchJobQueueDataSource_tags (120.22s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccBatchJobQueue_tags_ComputedTag_OnCreate (155.14s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_providerOnly (179.66s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_updateToResourceOnly
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_emptyResourceTag (122.67s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_emptyProviderOnlyTag (159.72s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_overlapping
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_updateToResourceOnly (162.45s)
=== CONT  TestAccBatchJobQueue_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_overlapping (155.65s)
=== CONT  TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_updateToProviderOnly (162.35s)
=== CONT  TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccBatchJobQueue_tags_DefaultTags_nonOverlapping (154.49s)
=== CONT  TestAccBatchJobQueueDataSource_schedulingPolicy
--- PASS: TestAccBatchJobQueueDataSource_schedulingPolicy (167.38s)
=== CONT  TestAccBatchJobQueue_tags
--- PASS: TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Add (152.73s)
=== CONT  TestAccBatchJobQueue_tags_EmptyTag_OnCreate
--- PASS: TestAccBatchJobQueue_tags_EmptyTag_OnUpdate_Replace (151.76s)
=== CONT  TestAccBatchJobQueue_tags_AddOnUpdate
--- PASS: TestAccBatchJobQueue_tags (183.65s)
=== CONT  TestAccBatchJobQueue_ComputeEnvironments_multiple
--- PASS: TestAccBatchJobQueue_tags_AddOnUpdate (151.15s)
=== CONT  TestAccBatchJobQueue_jobStateTimeLimitActionsMultiple
--- PASS: TestAccBatchJobQueue_tags_EmptyTag_OnCreate (159.33s)
=== CONT  TestAccBatchJobQueue_state
--- PASS: TestAccBatchJobQueue_ComputeEnvironments_multiple (189.32s)
=== CONT  TestAccBatchJobQueue_schedulingPolicy
--- PASS: TestAccBatchJobQueue_state (185.94s)
=== CONT  TestAccBatchJobQueue_priority
--- PASS: TestAccBatchJobQueue_jobStateTimeLimitActionsMultiple (196.65s)
=== CONT  TestAccBatchJobQueue_ComputeEnvironments_externalOrderUpdate
--- PASS: TestAccBatchJobQueue_schedulingPolicy (195.16s)
=== CONT  TestAccBatchJobQueue_ComputeEnvironmentOrder_multiple
--- PASS: TestAccBatchJobQueue_ComputeEnvironments_externalOrderUpdate (158.02s)
=== CONT  TestAccBatchJobQueue_basicCEO
--- PASS: TestAccBatchJobQueue_priority (196.21s)
=== CONT  TestAccBatchJobQueue_MigrateFromPluginSDK
--- PASS: TestAccBatchJobQueue_basicCEO (156.77s)
=== CONT  TestAccBatchJobQueue_disappearsCEO
--- PASS: TestAccBatchJobQueue_MigrateFromPluginSDK (129.71s)
=== CONT  TestAccBatchJobQueue_disappears
--- PASS: TestAccBatchJobQueue_ComputeEnvironmentOrder_multiple (194.47s)
=== CONT  TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccBatchJobQueue_disappearsCEO (136.09s)
=== CONT  TestAccBatchJobQueue_basic
--- PASS: TestAccBatchJobQueue_basic (146.60s)
=== CONT  TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace (153.80s)
=== CONT  TestAccBatchJobQueueDataSource_basic
--- PASS: TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add (145.95s)
--- PASS: TestAccBatchJobQueue_disappears (164.89s)
--- PASS: TestAccBatchJobQueueDataSource_basic (154.40s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/batch	1573.391s

@ewbankkit
Copy link
Contributor

@ChannyClaus Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 99a1bf7 into hashicorp:main Aug 16, 2024
39 checks passed
@github-actions github-actions bot added this to the v5.64.0 milestone Aug 16, 2024
@ChannyClaus ChannyClaus deleted the add-jobStateTimeLimitAction branch August 17, 2024 18:47
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 20, 2024
Copy link

This functionality has been released in v5.63.1 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/batch Issues and PRs that pertain to the batch service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: aws_batch_job_queue jobStateTimeLimitActions parameter
3 participants