Skip to content

feat: Add image_kubernetes_version arg to r/aws_batch_compute_environment #43454

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented Jul 20, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

n/a

Description

This PR is to add the compute_resources.ec2_configuration.image_kubernetes_version argument to the aws_batch_compute_environment resource.

Relations

Closes #43291

References

Referred to Ec2ConfigurationObject for specs and wordings.

Output from Acceptance Testing

Note: The TestAccBatchComputeEnvironment_upgradeV0ToV1 test case is written correctly, but it is failing to recognize the older provider version that supports the old compute_environment_name argument for some reason. I don't know how to fix it, so I'd appreciate a maintainer to take a look. Thanks.

$ make testacc TESTS="TestExpandEC2ConfigurationsUpdate|TestAccBatchComputeEnvironment_" PKG=batch
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.5 test ./internal/service/batch/... -v -count 1 -parallel 4 -run='TestExpandEC2ConfigurationsUpdate|TestAccBatchComputeEnvironment_'  -timeout 360m -vet=off
2025/07/19 23:09:13 Creating Terraform AWS Provider (SDKv2-style)...
2025/07/19 23:09:13 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccBatchComputeEnvironment_tags
=== PAUSE TestAccBatchComputeEnvironment_tags
=== RUN   TestAccBatchComputeEnvironment_tags_null
=== PAUSE TestAccBatchComputeEnvironment_tags_null
=== RUN   TestAccBatchComputeEnvironment_tags_EmptyMap
=== PAUSE TestAccBatchComputeEnvironment_tags_EmptyMap
=== RUN   TestAccBatchComputeEnvironment_tags_AddOnUpdate
=== PAUSE TestAccBatchComputeEnvironment_tags_AddOnUpdate
=== RUN   TestAccBatchComputeEnvironment_tags_EmptyTag_OnCreate
=== PAUSE TestAccBatchComputeEnvironment_tags_EmptyTag_OnCreate
=== RUN   TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Add
=== PAUSE TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Add
=== RUN   TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Replace
=== PAUSE TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Replace
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_providerOnly
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_providerOnly
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_nonOverlapping
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_overlapping
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_overlapping
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_emptyResourceTag
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_emptyResourceTag
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_emptyProviderOnlyTag
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_emptyProviderOnlyTag
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_nullOverlappingResourceTag
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_nullOverlappingResourceTag
=== RUN   TestAccBatchComputeEnvironment_tags_DefaultTags_nullNonOverlappingResourceTag
=== PAUSE TestAccBatchComputeEnvironment_tags_DefaultTags_nullNonOverlappingResourceTag
=== RUN   TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate
=== PAUSE TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate
=== RUN   TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_DefaultTag
=== PAUSE TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_DefaultTag
=== RUN   TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_ResourceTag
=== PAUSE TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_ResourceTag
=== RUN   TestExpandEC2ConfigurationsUpdate
=== PAUSE TestExpandEC2ConfigurationsUpdate
=== RUN   TestAccBatchComputeEnvironment_basic
=== PAUSE TestAccBatchComputeEnvironment_basic
=== RUN   TestAccBatchComputeEnvironment_disappears
=== PAUSE TestAccBatchComputeEnvironment_disappears
=== RUN   TestAccBatchComputeEnvironment_nameGenerated
=== PAUSE TestAccBatchComputeEnvironment_nameGenerated
=== RUN   TestAccBatchComputeEnvironment_namePrefix
=== PAUSE TestAccBatchComputeEnvironment_namePrefix
=== RUN   TestAccBatchComputeEnvironment_upgradeV0ToV1
=== PAUSE TestAccBatchComputeEnvironment_upgradeV0ToV1
=== RUN   TestAccBatchComputeEnvironment_eksConfiguration
=== PAUSE TestAccBatchComputeEnvironment_eksConfiguration
=== RUN   TestAccBatchComputeEnvironment_createEC2
=== PAUSE TestAccBatchComputeEnvironment_createEC2
=== RUN   TestAccBatchComputeEnvironment_updatePolicyCreate
=== PAUSE TestAccBatchComputeEnvironment_updatePolicyCreate
=== RUN   TestAccBatchComputeEnvironment_updatePolicyUpdate
=== PAUSE TestAccBatchComputeEnvironment_updatePolicyUpdate
=== RUN   TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== PAUSE TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== RUN   TestAccBatchComputeEnvironment_createSpot
=== PAUSE TestAccBatchComputeEnvironment_createSpot
=== RUN   TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
=== PAUSE TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
=== RUN   TestAccBatchComputeEnvironment_createFargate
=== PAUSE TestAccBatchComputeEnvironment_createFargate
=== RUN   TestAccBatchComputeEnvironment_createFargateSpot
=== PAUSE TestAccBatchComputeEnvironment_createFargateSpot
=== RUN   TestAccBatchComputeEnvironment_updateState
=== PAUSE TestAccBatchComputeEnvironment_updateState
=== RUN   TestAccBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccBatchComputeEnvironment_defaultServiceRole
=== RUN   TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
=== PAUSE TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
=== RUN   TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
=== PAUSE TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
=== RUN   TestAccBatchComputeEnvironment_ec2Configuration
=== PAUSE TestAccBatchComputeEnvironment_ec2Configuration
=== RUN   TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
=== PAUSE TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
=== RUN   TestAccBatchComputeEnvironment_launchTemplate
=== PAUSE TestAccBatchComputeEnvironment_launchTemplate
=== RUN   TestAccBatchComputeEnvironment_updateLaunchTemplate
=== PAUSE TestAccBatchComputeEnvironment_updateLaunchTemplate
=== RUN   TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
=== PAUSE TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
=== RUN   TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
=== PAUSE TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
=== RUN   TestAccBatchComputeEnvironment_updateEC2
=== PAUSE TestAccBatchComputeEnvironment_updateEC2
=== RUN   TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
=== PAUSE TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
=== CONT  TestAccBatchComputeEnvironment_tags
=== CONT  TestAccBatchComputeEnvironment_namePrefix
=== CONT  TestAccBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
--- PASS: TestAccBatchComputeEnvironment_namePrefix (47.61s)
=== CONT  TestAccBatchComputeEnvironment_launchTemplate
--- PASS: TestAccBatchComputeEnvironment_updateServiceRole (69.16s)
=== CONT  TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
--- PASS: TestAccBatchComputeEnvironment_createEC2WithoutComputeResources (14.37s)
=== CONT  TestAccBatchComputeEnvironment_updateEC2
--- PASS: TestAccBatchComputeEnvironment_tags (93.91s)
=== CONT  TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
--- PASS: TestAccBatchComputeEnvironment_launchTemplate (46.59s)
=== CONT  TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
--- PASS: TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources (1.73s)
=== CONT  TestAccBatchComputeEnvironment_updateLaunchTemplate
--- PASS: TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate (67.99s)
=== CONT  TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
--- PASS: TestAccBatchComputeEnvironment_updateLaunchTemplate (71.71s)
=== CONT  TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
--- PASS: TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags (181.70s)
=== CONT  TestAccBatchComputeEnvironment_ec2Configuration
--- PASS: TestAccBatchComputeEnvironment_updateEC2 (107.81s)
=== CONT  TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
--- PASS: TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup (46.52s)
=== CONT  TestAccBatchComputeEnvironment_createEC2
--- PASS: TestAccBatchComputeEnvironment_ec2Configuration (46.68s)
=== CONT  TestAccBatchComputeEnvironment_updatePolicyUpdate
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs (77.14s)
=== CONT  TestAccBatchComputeEnvironment_updatePolicyCreate
--- PASS: TestAccBatchComputeEnvironment_createEC2 (42.01s)
=== CONT  TestAccBatchComputeEnvironment_defaultServiceRole
--- PASS: TestAccBatchComputeEnvironment_updatePolicyUpdate (55.87s)
=== CONT  TestAccBatchComputeEnvironment_eksConfiguration
--- PASS: TestAccBatchComputeEnvironment_defaultServiceRole (40.45s)
=== CONT  TestAccBatchComputeEnvironment_upgradeV0ToV1
    compute_environment_test.go:306: Step 1/2 error: Error running pre-apply plan: exit status 1

        Error: Unsupported argument

          on terraform_plugin_test.tf line 114, in resource "aws_batch_compute_environment" "test":
         114:   compute_environment_name = "tf-acc-test-4756516976199859590"

        An argument named "compute_environment_name" is not expected here.
--- FAIL: TestAccBatchComputeEnvironment_upgradeV0ToV1 (11.58s)
=== CONT  TestAccBatchComputeEnvironment_createFargate
--- PASS: TestAccBatchComputeEnvironment_updatePolicyCreate (69.33s)
=== CONT  TestAccBatchComputeEnvironment_updateState
--- PASS: TestAccBatchComputeEnvironment_createFargate (51.42s)
=== CONT  TestAccBatchComputeEnvironment_createFargateSpot
--- PASS: TestAccBatchComputeEnvironment_updateState (51.45s)
=== CONT  TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
--- PASS: TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage (42.07s)
=== CONT  TestAccBatchComputeEnvironment_createSpot
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_minVCPUs (215.81s)
=== CONT  TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccBatchComputeEnvironment_createFargateSpot (50.99s)
=== CONT  TestAccBatchComputeEnvironment_nameGenerated
--- PASS: TestAccBatchComputeEnvironment_nameGenerated (46.20s)
=== CONT  TestAccBatchComputeEnvironment_disappears
--- PASS: TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_DefaultTag (60.94s)
=== CONT  TestAccBatchComputeEnvironment_basic
--- PASS: TestAccBatchComputeEnvironment_disappears (43.76s)
=== CONT  TestExpandEC2ConfigurationsUpdate
--- PASS: TestExpandEC2ConfigurationsUpdate (0.00s)
=== CONT  TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccBatchComputeEnvironment_basic (35.41s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_providerOnly
--- PASS: TestAccBatchComputeEnvironment_tags_IgnoreTags_Overlap_ResourceTag (66.16s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_emptyResourceTag (46.81s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_updateToResourceOnly
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_providerOnly (110.39s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_updateToResourceOnly (65.46s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_overlapping
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_updateToProviderOnly (65.46s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_nonOverlapping (101.15s)
=== CONT  TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_overlapping (101.82s)
=== CONT  TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate (43.56s)
=== CONT  TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccBatchComputeEnvironment_eksConfiguration (542.93s)
=== CONT  TestAccBatchComputeEnvironment_tags_EmptyTag_OnCreate
--- PASS: TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace (62.91s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccBatchComputeEnvironment_createSpot (472.80s)
=== CONT  TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add (62.83s)
=== CONT  TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_emptyProviderOnlyTag (47.78s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_nullNonOverlappingResourceTag
--- PASS: TestAccBatchComputeEnvironment_tags_EmptyTag_OnCreate (74.30s)
=== CONT  TestAccBatchComputeEnvironment_tags_EmptyMap
--- PASS: TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Replace (60.20s)
=== CONT  TestAccBatchComputeEnvironment_tags_DefaultTags_nullOverlappingResourceTag
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_nullNonOverlappingResourceTag (44.61s)
=== CONT  TestAccBatchComputeEnvironment_tags_AddOnUpdate
--- PASS: TestAccBatchComputeEnvironment_tags_EmptyMap (53.04s)
=== CONT  TestAccBatchComputeEnvironment_tags_null
--- PASS: TestAccBatchComputeEnvironment_tags_EmptyTag_OnUpdate_Add (76.29s)
--- PASS: TestAccBatchComputeEnvironment_tags_DefaultTags_nullOverlappingResourceTag (41.81s)
--- PASS: TestAccBatchComputeEnvironment_tags_AddOnUpdate (60.06s)
--- PASS: TestAccBatchComputeEnvironment_tags_null (49.02s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/batch      1003.901s
FAIL
make: *** [GNUmakefile:642: testacc] Error 1

$

@acwwat acwwat requested a review from a team as a code owner July 20, 2025 04:03
Copy link

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

Copy link

github-actions bot commented Jul 20, 2025

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/batch Issues and PRs that pertain to the batch service. size/S Managed by automation to categorize the size of a PR. external-maintainer Contribution from a trusted external contributor. labels Jul 20, 2025
@acwwat acwwat force-pushed the f-aws_batch_compute_environment-add_img_k8s_ver_arg branch from 5063f14 to 2eae91e Compare July 20, 2025 04:04
@acwwat acwwat force-pushed the f-aws_batch_compute_environment-add_img_k8s_ver_arg branch from 2eae91e to daa8e97 Compare July 20, 2025 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. external-maintainer Contribution from a trusted external contributor. needs-triage Waiting for first response or review from a maintainer. service/batch Issues and PRs that pertain to the batch service. size/S Managed by automation to categorize the size of a PR. 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.

Adding missing attribute "ImageKubernetesVersion " to aws_batch_compute_environment
1 participant