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

refactor!(batch): migrate job_definition resource from sdk to framework #40753

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SKalt
Copy link

@SKalt SKalt commented Jan 2, 2025

Description

This PR replaces the current terraform-plugin-sdk implementation of the aws_batch_job_definition resource with a terraform-plugin-framework-based implementation that tracks container_properties as a block rather than a JSON string.

Thanks to @danquack for guiding me through this one, and especially for figuring out the correct tag-decorator syntax.

Relations

Closes #29817
Closes #40747

References

Output from Acceptance Testing

%  make testacc TESTS=TestAccBatchJobDefinition PKG=batch
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchJobDefinition'  -timeout 360m
2025/01/02 17:19:05 Initializing Terraform AWS Provider...
=== RUN   TestAccBatchJobDefinitionDataSource_tags
=== PAUSE TestAccBatchJobDefinitionDataSource_tags
=== RUN   TestAccBatchJobDefinitionDataSource_tags_NullMap
=== PAUSE TestAccBatchJobDefinitionDataSource_tags_NullMap
=== RUN   TestAccBatchJobDefinitionDataSource_tags_EmptyMap
=== PAUSE TestAccBatchJobDefinitionDataSource_tags_EmptyMap
=== RUN   TestAccBatchJobDefinitionDataSource_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccBatchJobDefinitionDataSource_tags_DefaultTags_nonOverlapping
=== RUN   TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_DefaultTag
=== PAUSE TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_DefaultTag
=== RUN   TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_ResourceTag
=== PAUSE TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_ResourceTag
=== RUN   TestAccBatchJobDefinitionDataSource_basicName
=== PAUSE TestAccBatchJobDefinitionDataSource_basicName
=== RUN   TestAccBatchJobDefinitionDataSource_basicARN
=== PAUSE TestAccBatchJobDefinitionDataSource_basicARN
=== RUN   TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties
=== PAUSE TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties
=== RUN   TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties
=== PAUSE TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties
=== RUN   TestAccBatchJobDefinition_MigrateFromSDKToPluginFramework
=== PAUSE TestAccBatchJobDefinition_MigrateFromSDKToPluginFramework
=== RUN   TestAccBatchJobDefinition_tags
=== PAUSE TestAccBatchJobDefinition_tags
=== RUN   TestAccBatchJobDefinition_tags_null
=== PAUSE TestAccBatchJobDefinition_tags_null
=== RUN   TestAccBatchJobDefinition_tags_EmptyMap
=== PAUSE TestAccBatchJobDefinition_tags_EmptyMap
=== RUN   TestAccBatchJobDefinition_tags_AddOnUpdate
=== PAUSE TestAccBatchJobDefinition_tags_AddOnUpdate
=== RUN   TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
=== PAUSE TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
=== RUN   TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
=== PAUSE TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
=== RUN   TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
=== PAUSE TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_overlapping
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_overlapping
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== RUN   TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
=== PAUSE TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
=== RUN   TestAccBatchJobDefinition_tags_ComputedTag_OnCreate
=== PAUSE TestAccBatchJobDefinition_tags_ComputedTag_OnCreate
=== RUN   TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag
=== PAUSE TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag
=== RUN   TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag
=== PAUSE TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag
=== RUN   TestAccBatchJobDefinition_basic
=== PAUSE TestAccBatchJobDefinition_basic
=== RUN   TestAccBatchJobDefinition_attributes
=== PAUSE TestAccBatchJobDefinition_attributes
=== RUN   TestAccBatchJobDefinition_disappears
=== PAUSE TestAccBatchJobDefinition_disappears
=== RUN   TestAccBatchJobDefinition_PlatformCapabilities_ec2
=== PAUSE TestAccBatchJobDefinition_PlatformCapabilities_ec2
=== RUN   TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
=== PAUSE TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
=== RUN   TestAccBatchJobDefinition_PlatformCapabilities_fargate
=== PAUSE TestAccBatchJobDefinition_PlatformCapabilities_fargate
=== RUN   TestAccBatchJobDefinition_ContainerProperties_advanced
=== PAUSE TestAccBatchJobDefinition_ContainerProperties_advanced
=== RUN   TestAccBatchJobDefinition_ContainerProperties_minorUpdate
=== PAUSE TestAccBatchJobDefinition_ContainerProperties_minorUpdate
=== RUN   TestAccBatchJobDefinition_propagateTags
=== PAUSE TestAccBatchJobDefinition_propagateTags
=== RUN   TestAccBatchJobDefinition_ContainerProperties_EmptyField
=== PAUSE TestAccBatchJobDefinition_ContainerProperties_EmptyField
=== RUN   TestAccBatchJobDefinition_NodeProperties_basic
=== PAUSE TestAccBatchJobDefinition_NodeProperties_basic
=== RUN   TestAccBatchJobDefinition_NodeProperties_advanced
=== PAUSE TestAccBatchJobDefinition_NodeProperties_advanced
=== RUN   TestAccBatchJobDefinition_NodeProperties_withEKS
=== PAUSE TestAccBatchJobDefinition_NodeProperties_withEKS
=== RUN   TestAccBatchJobDefinition_NodeProperties_withECS
=== PAUSE TestAccBatchJobDefinition_NodeProperties_withECS
=== RUN   TestAccBatchJobDefinition_EKSProperties_basic
=== PAUSE TestAccBatchJobDefinition_EKSProperties_basic
=== RUN   TestAccBatchJobDefinition_EKSProperties_update
=== PAUSE TestAccBatchJobDefinition_EKSProperties_update
=== RUN   TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
=== PAUSE TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
=== RUN   TestAccBatchJobDefinition_EKSProperties_multiContainers
=== PAUSE TestAccBatchJobDefinition_EKSProperties_multiContainers
=== RUN   TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
=== PAUSE TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
=== RUN   TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
=== PAUSE TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
=== RUN   TestAccBatchJobDefinition_schedulingPriority
=== PAUSE TestAccBatchJobDefinition_schedulingPriority
=== RUN   TestAccBatchJobDefinition_emptyRetryStrategy
=== PAUSE TestAccBatchJobDefinition_emptyRetryStrategy
=== RUN   TestAccBatchJobDefinition_ECSProperties_update
=== PAUSE TestAccBatchJobDefinition_ECSProperties_update
=== RUN   TestAccBatchJobDefinition_updateWithTags
=== PAUSE TestAccBatchJobDefinition_updateWithTags
=== CONT  TestAccBatchJobDefinitionDataSource_tags
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add
=== CONT  TestAccBatchJobDefinition_NodeProperties_basic
=== CONT  TestAccBatchJobDefinition_tags_AddOnUpdate
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnCreate
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_overlapping
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
=== CONT  TestAccBatchJobDefinition_EKSProperties_multiContainers
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
=== CONT  TestAccBatchJobDefinition_updateWithTags
=== CONT  TestAccBatchJobDefinition_EKSProperties_basic
--- PASS: TestAccBatchJobDefinitionDataSource_tags (22.82s)
=== CONT  TestAccBatchJobDefinition_ECSProperties_update
--- PASS: TestAccBatchJobDefinition_EKSProperties_multiContainers (24.61s)
=== CONT  TestAccBatchJobDefinition_emptyRetryStrategy
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (24.69s)
=== CONT  TestAccBatchJobDefinition_schedulingPriority
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (25.55s)
=== CONT  TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (1.55s)
=== CONT  TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag (27.69s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag (28.47s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyMap
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (2.04s)
=== CONT  TestAccBatchJobDefinition_tags_null
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag (32.11s)
=== CONT  TestAccBatchJobDefinition_tags
--- PASS: TestAccBatchJobDefinition_emptyRetryStrategy (7.55s)
=== CONT  TestAccBatchJobDefinition_MigrateFromSDKToPluginFramework
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag (37.96s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnCreate (39.11s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly (48.32s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_withEKS
--- PASS: TestAccBatchJobDefinition_updateWithTags (48.49s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_advanced
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace (48.91s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_withECS
--- PASS: TestAccBatchJobDefinition_schedulingPriority (26.27s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_ec2
--- PASS: TestAccBatchJobDefinition_tags_AddOnUpdate (51.13s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_minorUpdate
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add (51.93s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_advanced
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly (53.80s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_EmptyField
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnCreate (54.93s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_fargate
--- PASS: TestAccBatchJobDefinition_tags_EmptyMap (27.41s)
=== CONT  TestAccBatchJobDefinition_propagateTags
--- PASS: TestAccBatchJobDefinition_tags_null (27.24s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties (21.18s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_update
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties (20.94s)
=== CONT  TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccBatchJobDefinition_ECSProperties_update (37.65s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicName
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN (36.14s)
=== CONT  TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccBatchJobDefinition_NodeProperties_withEKS (24.47s)
=== CONT  TestAccBatchJobDefinitionDataSource_tags_EmptyMap
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping (73.93s)
=== CONT  TestAccBatchJobDefinitionDataSource_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (23.35s)
=== CONT  TestAccBatchJobDefinitionDataSource_tags_NullMap
--- PASS: TestAccBatchJobDefinition_NodeProperties_withECS (25.76s)
=== CONT  TestAccBatchJobDefinition_basic
--- PASS: TestAccBatchJobDefinition_propagateTags (19.45s)
=== CONT  TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (22.79s)
=== CONT  TestAccBatchJobDefinition_disappears
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add (77.37s)
=== CONT  TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (23.50s)
=== CONT  TestAccBatchJobDefinition_attributes
--- PASS: TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_DefaultTag (19.51s)
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (23.92s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
--- PASS: TestAccBatchJobDefinitionDataSource_tags_IgnoreTags_Overlap_ResourceTag (19.66s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_overlapping (83.59s)
--- PASS: TestAccBatchJobDefinition_MigrateFromSDKToPluginFramework (51.56s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (39.68s)
--- PASS: TestAccBatchJobDefinitionDataSource_tags_EmptyMap (17.65s)
--- PASS: TestAccBatchJobDefinitionDataSource_tags_NullMap (18.26s)
--- PASS: TestAccBatchJobDefinitionDataSource_basicName (33.19s)
--- PASS: TestAccBatchJobDefinition_disappears (17.09s)
--- PASS: TestAccBatchJobDefinition_basic (21.11s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (37.41s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_providerOnly (98.09s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_imagePullSecrets (19.74s)
--- PASS: TestAccBatchJobDefinitionDataSource_tags_DefaultTags_nonOverlapping (26.73s)
--- PASS: TestAccBatchJobDefinition_tags (79.75s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace (33.44s)
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag (38.77s)
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag (41.36s)
--- PASS: TestAccBatchJobDefinition_attributes (48.12s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_minorUpdate (78.06s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (86.35s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/batch      142.394s

Co-authored-by:  Daniel Quackenbush <25692880+danquack@users.noreply.github.com>
@SKalt SKalt requested a review from a team as a code owner January 2, 2025 22:35
Copy link

github-actions bot commented Jan 2, 2025

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 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. sweeper Pertains to changes to or issues with the sweeper. generators Relates to code generators. service/events Issues and PRs that pertain to the events service. service/pipes Issues and PRs that pertain to the pipes service. needs-triage Waiting for first response or review from a maintainer. labels Jan 2, 2025
SKalt added a commit to SKalt/terraform-provider-aws that referenced this pull request Jan 3, 2025
@SKalt SKalt force-pushed the f-migrate_batch_job_from_sdk_to_framework branch from 3b6fc87 to fd3d6e4 Compare January 3, 2025 14:30
@drewmullen drewmullen added this to the v6.0.0 milestone Jan 6, 2025
@drewmullen drewmullen added the breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. label Jan 6, 2025
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. documentation Introduces or discusses updates to documentation. generators Relates to code generators. service/batch Issues and PRs that pertain to the batch service. service/events Issues and PRs that pertain to the events service. service/pipes Issues and PRs that pertain to the pipes service. sweeper Pertains to changes to or issues with the sweeper. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
4 participants