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

batch job definition remove force new and increment revisions #35149

Merged

Conversation

drewmullen
Copy link
Collaborator

@drewmullen drewmullen commented Jan 4, 2024

Description

This change first started as a larger PR and the commits were pulled into a separate PR for isolation

Summary

job_definition (JD) was previously a ForceNew resource on all parameters. This was interesting because when a JD is deleted in AWS the revision still lasts but is marked as inactive. In some ways, the ForceNew didnt matter because a new revision was being created. This PR modifies the behavior so that instead of deleting each revision as a new is created, we merely add a new one.

Design decisions

  • old revisions are deactivated by default (prior behavior). This can be disabled by new param deregister_on_new_revision
  • delete now deregisters all JDs with the associated name
  • testing delete function (testAccCheckJobDefinitionDestroy) now checks to see if any revisions exist and fails accordingly
  • Added new functions in testing testAccCheckJobDefinitionPreviousRegistered and testAccCheckJobDefinitionPreviousDeregistered to validate change from ForceNew to rev updates

Testing changes

  • removed test: _updateForcesNewResource -> coverage by _attributes
  • removed test: _NodePropertiesupdateForcesNewResource -> coverage by _NodeProperties_basic
  • modified function: testAccCheckJobDefinitionDestroy now checks for all revisions to be deregistered

Relations

Closes #29819

References

Output from Acceptance Testing

$  make testacc TESTS=TestAccBatchJobDefinition_ PKG=batch     
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchJobDefinition_'  -timeout 360m

--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (27.55s)
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (27.66s)
--- PASS: TestAccBatchJobDefinition_propagateTags (71.25s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (77.16s)
--- PASS: TestAccBatchJobDefinition_schedulingPriority (77.66s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (77.86s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (79.69s)
--- PASS: TestAccBatchJobDefinition_basic (79.72s)
--- PASS: TestAccBatchJobDefinition_disappears (83.39s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (83.50s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (84.21s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (99.79s)
--- PASS: TestAccBatchJobDefinition_tags (117.38s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (133.64s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (133.68s)
--- PASS: TestAccBatchJobDefinition_attributes (134.86s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/batch      137.241s
...

Copy link

github-actions bot commented Jan 4, 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 size/XL Managed by automation to categorize the size of a PR. 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. client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. labels Jan 4, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Jan 4, 2024
Copy link

github-actions bot commented Jan 4, 2024

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@drewmullen drewmullen removed the needs-triage Waiting for first response or review from a maintainer. label Jan 4, 2024
@drewmullen drewmullen changed the title WIP F batch job definition rm force new batch job definition remove force new and increment revisions Jan 8, 2024
@drewmullen drewmullen force-pushed the f-batch_job_definition-RM_ForceNew branch from 854edfa to ecd9edc Compare January 11, 2024 15:01
@drewmullen drewmullen marked this pull request as ready for review January 12, 2024 13:27
@drewmullen drewmullen force-pushed the f-batch_job_definition-RM_ForceNew branch from 521d649 to c1cc669 Compare February 20, 2024 14:47
@drewmullen
Copy link
Collaborator Author

rebased:

$ make testacc TESTS=TestAccBatchJobDefinition_ PKG=batch

--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (87.13s)
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (87.25s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (244.90s)
--- PASS: TestAccBatchJobDefinition_propagateTags (247.71s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (250.55s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (253.95s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (258.68s)
--- PASS: TestAccBatchJobDefinition_basic (258.96s)
--- PASS: TestAccBatchJobDefinition_disappears (260.92s)
--- PASS: TestAccBatchJobDefinition_schedulingPriority (262.80s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (317.48s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (319.84s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (324.10s)
--- PASS: TestAccBatchJobDefinition_tags (383.79s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (420.52s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (422.02s)
--- PASS: TestAccBatchJobDefinition_attributes (423.58s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/batch	429.964s

@github-actions github-actions bot removed client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. labels Feb 20, 2024
@drewmullen drewmullen requested a review from gdavison March 25, 2024 13:40
@drewmullen drewmullen force-pushed the f-batch_job_definition-RM_ForceNew branch from 9cf9b62 to fa2ff1d Compare March 25, 2024 14:30
@delagoya
Copy link

This PR has been open since Jan 4. Any way we can get a review and merge?

Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (10.47s)
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (10.52s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (24.15s)
--- PASS: TestAccBatchJobDefinition_basic (25.87s)
--- PASS: TestAccBatchJobDefinition_schedulingPriority (27.06s)
--- PASS: TestAccBatchJobDefinition_propagateTags (31.76s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (31.87s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (32.81s)
--- PASS: TestAccBatchJobDefinition_disappears (33.76s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (35.76s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (36.52s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (36.79s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (37.01s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (37.60s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (41.82s)
--- PASS: TestAccBatchJobDefinition_tags (43.20s)
--- PASS: TestAccBatchJobDefinition_attributes (49.11s)

@gdavison gdavison merged commit cd748df into hashicorp:main Apr 2, 2024
43 checks passed
@github-actions github-actions bot added this to the v5.44.0 milestone Apr 2, 2024
Copy link

github-actions bot commented Apr 5, 2024

This functionality has been released in v5.44.0 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

github-actions bot commented May 7, 2024

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 May 7, 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. external-maintainer Contribution from a trusted external contributor. service/batch Issues and PRs that pertain to the batch service. size/XL 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.

[Enhancement]: aws_batch_job_description should publish new revision, not recreate the resource
4 participants