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

Fix empty retry_strategy of Batch JobDefinition causing panics #37500

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

Conversation

flostadler
Copy link

@flostadler flostadler commented May 14, 2024

Description

Computing whether a Batch JobDefinition has a diff panics if the retry_strategy is empty.
This is a valid configuration because all properties of retry_strategy are optional.

This patch fixes that by adding the missing nil checks for the retry strategy.

Relations

Closes #37349

References

Output from Acceptance Testing

% make testacc TESTS=TestAccBatchJobDefinition_ PKG=batch
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchJobDefinition_'  -timeout 360m
=== RUN   TestAccBatchJobDefinition_tags
=== PAUSE TestAccBatchJobDefinition_tags
=== RUN   TestAccBatchJobDefinition_tags_null
=== PAUSE TestAccBatchJobDefinition_tags_null
=== 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_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_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_EKSProperties_basic
=== PAUSE TestAccBatchJobDefinition_EKSProperties_basic
=== RUN   TestAccBatchJobDefinition_EKSProperties_update
=== PAUSE TestAccBatchJobDefinition_EKSProperties_update
=== RUN   TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
=== PAUSE TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
=== RUN   TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
=== PAUSE TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
=== RUN   TestAccBatchJobDefinition_schedulingPriority
=== PAUSE TestAccBatchJobDefinition_schedulingPriority
=== RUN   TestAccBatchJobDefinition_emptyRetryStrategy
=== PAUSE TestAccBatchJobDefinition_emptyRetryStrategy
=== CONT  TestAccBatchJobDefinition_tags
=== CONT  TestAccBatchJobDefinition_attributes
=== CONT  TestAccBatchJobDefinition_NodeProperties_basic
=== CONT  TestAccBatchJobDefinition_EKSProperties_update
=== CONT  TestAccBatchJobDefinition_EKSProperties_basic
=== CONT  TestAccBatchJobDefinition_NodeProperties_advanced
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
=== CONT  TestAccBatchJobDefinition_basic
=== CONT  TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add
=== CONT  TestAccBatchJobDefinition_emptyRetryStrategy
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnCreate
=== CONT  TestAccBatchJobDefinition_schedulingPriority
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (17.63s)
=== CONT  TestAccBatchJobDefinition_propagateTags
--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (17.70s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_fargate
--- PASS: TestAccBatchJobDefinition_emptyRetryStrategy (47.48s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_EmptyField
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag (48.04s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag (51.98s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchJobDefinition_basic (52.34s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag (52.40s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_overlapping
--- PASS: TestAccBatchJobDefinition_schedulingPriority (52.47s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_advanced
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (53.20s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (54.24s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_minorUpdate
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnCreate (54.33s)
=== CONT  TestAccBatchJobDefinition_tags_AddOnUpdate
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (55.37s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccBatchJobDefinition_propagateTags (39.59s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_ec2
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (47.90s)
=== CONT  TestAccBatchJobDefinition_tags_null
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly (70.90s)
=== CONT  TestAccBatchJobDefinition_disappears
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly (74.11s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace (76.38s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (79.50s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (79.98s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add (80.38s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (40.52s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (36.41s)
--- PASS: TestAccBatchJobDefinition_disappears (28.17s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace (58.87s)
--- PASS: TestAccBatchJobDefinition_tags_null (41.87s)
--- PASS: TestAccBatchJobDefinition_tags_AddOnUpdate (53.87s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnCreate (60.17s)
--- PASS: TestAccBatchJobDefinition_attributes (115.33s)
--- PASS: TestAccBatchJobDefinition_tags (123.28s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add (74.64s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping (78.43s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_overlapping (81.04s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_providerOnly (98.29s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_minorUpdate (110.53s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (119.22s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/batch	175.002s

Computing whether a Batch JobDefinition has a diff panics if the `retry_strategy` is empty.
This is a valid configuration because all properties of `retry_strategy` are optional.

This patch fixes that by adding the missing nil checks for the retry strategy.

Fixes hashicorp#37349
Copy link

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/XS Managed by automation to categorize the size of a PR. service/batch Issues and PRs that pertain to the batch service. labels May 14, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 14, 2024
Copy link

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

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 @flostadler 👋

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! 😃

@github-actions github-actions bot added size/S 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. provider Pertains to the provider itself, rather than any interaction with AWS. and removed size/XS Managed by automation to categorize the size of a PR. labels May 14, 2024
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. and removed needs-triage Waiting for first response or review from a maintainer. labels May 16, 2024
@crLawther
Copy link

Any updates on this expected closure date?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. 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.

[Bug]: Empty retry_strategy of aws_batch_job_definition causes panics
3 participants