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

r/aws_batch_job_definition: Ensure that any newly created revision is tagged correctly #39797

Merged
merged 9 commits into from
Oct 21, 2024

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Oct 18, 2024

Description

Ensures that new revisions get the same tags as the previous.

Relations

Closes #39795.
Closes #38302.
Closes #38053.
Closes #37254.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccBatchJobDefinition_' PKG=batch ACCTEST_PARALLELISM=4
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/batch/... -v -count 1 -parallel 4  -run=TestAccBatchJobDefinition_ -timeout 360m
2024/10/18 12:25:41 Initializing Terraform AWS Provider...
=== 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_EKSProperties_basic
=== PAUSE TestAccBatchJobDefinition_EKSProperties_basic
=== RUN   TestAccBatchJobDefinition_EKSProperties_update
=== PAUSE TestAccBatchJobDefinition_EKSProperties_update
=== RUN   TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
=== PAUSE TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
=== 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  TestAccBatchJobDefinition_tags
=== CONT  TestAccBatchJobDefinition_basic
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccBatchJobDefinition_NodeProperties_advanced
--- PASS: TestAccBatchJobDefinition_basic (12.96s)
=== CONT  TestAccBatchJobDefinition_updateWithTags
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly (20.90s)
=== CONT  TestAccBatchJobDefinition_ECSProperties_update
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (24.00s)
=== CONT  TestAccBatchJobDefinition_emptyRetryStrategy
--- PASS: TestAccBatchJobDefinition_updateWithTags (19.54s)
=== CONT  TestAccBatchJobDefinition_schedulingPriority
--- PASS: TestAccBatchJobDefinition_emptyRetryStrategy (11.04s)
=== CONT  TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (3.20s)
=== CONT  TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
--- PASS: TestAccBatchJobDefinition_ECSProperties_update (18.57s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_imagePullSecrets
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (3.30s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_update
--- PASS: TestAccBatchJobDefinition_schedulingPriority (12.13s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_basic
--- PASS: TestAccBatchJobDefinition_tags (45.86s)
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnCreate
--- PASS: TestAccBatchJobDefinition_EKSProperties_imagePullSecrets (12.14s)
=== CONT  TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (12.21s)
=== CONT  TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (19.81s)
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnCreate (16.65s)
=== CONT  TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag (32.20s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag (27.20s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace (24.84s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add (24.80s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag (13.35s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_overlapping
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag (13.35s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_advanced
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace (21.87s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_basic
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly (21.67s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_EmptyField
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (12.35s)
=== CONT  TestAccBatchJobDefinition_propagateTags
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (12.41s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_minorUpdate
--- PASS: TestAccBatchJobDefinition_propagateTags (9.88s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_overlapping (35.90s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag (13.37s)
=== CONT  TestAccBatchJobDefinition_tags_AddOnUpdate
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag (13.55s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (53.56s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
--- PASS: TestAccBatchJobDefinition_tags_AddOnUpdate (21.36s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_ec2
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnCreate (23.74s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_fargate
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (12.08s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add (32.02s)
=== CONT  TestAccBatchJobDefinition_tags_EmptyMap
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (12.94s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (13.16s)
=== CONT  TestAccBatchJobDefinition_disappears
--- PASS: TestAccBatchJobDefinition_ContainerProperties_minorUpdate (70.40s)
=== CONT  TestAccBatchJobDefinition_attributes
--- PASS: TestAccBatchJobDefinition_tags_EmptyMap (16.47s)
=== CONT  TestAccBatchJobDefinition_tags_null
--- PASS: TestAccBatchJobDefinition_disappears (10.38s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchJobDefinition_tags_null (16.44s)
--- PASS: TestAccBatchJobDefinition_attributes (34.77s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_providerOnly (46.11s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping (35.32s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/batch	240.987s

% make testacc TESTARGS='-run=TestAccBatchJobDefinition_updateWithTags' PKG=batch
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/batch/... -v -count 1 -parallel 20  -run=TestAccBatchJobDefinition_updateWithTags -timeout 360m
2024/10/18 12:15:58 Initializing Terraform AWS Provider...
=== RUN   TestAccBatchJobDefinition_updateWithTags
=== PAUSE TestAccBatchJobDefinition_updateWithTags
=== CONT  TestAccBatchJobDefinition_updateWithTags
    job_definition_test.go:1027: Step 2/2 error: Post-apply refresh state check(s) failed:
        error checking value for attribute at path: aws_batch_job_definition.test.tags, err: expected 1 element for MapExact check, got 0 elements
        error checking value for attribute at path: aws_batch_job_definition.test.tags_all, err: expected 1 element for MapExact check, got 0 elements
--- FAIL: TestAccBatchJobDefinition_updateWithTags (18.49s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/batch	23.710s
FAIL
make: *** [testacc] Error 1
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 tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/batch Issues and PRs that pertain to the batch service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Oct 18, 2024
@ewbankkit ewbankkit marked this pull request as ready for review October 18, 2024 16:52
@ewbankkit ewbankkit requested a review from a team as a code owner October 18, 2024 16:52
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. tags Pertains to resource tagging. labels Oct 18, 2024
@gdavison gdavison self-assigned this Oct 21, 2024
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.

A couple comments, otherwise looks good

--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (20.63s)
--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (22.31s)
--- PASS: TestAccBatchJobDefinition_emptyRetryStrategy (71.93s)
--- PASS: TestAccBatchJobDefinition_schedulingPriority (73.57s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_imagePullSecrets (78.26s)
--- PASS: TestAccBatchJobDefinition_basic (83.33s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (75.16s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyMap (104.98s)
--- PASS: TestAccBatchJobDefinition_tags_null (105.10s)
--- PASS: TestAccBatchJobDefinition_ECSProperties_update (105.81s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (112.05s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly (115.70s)
--- PASS: TestAccBatchJobDefinition_updateWithTags (116.47s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly (119.78s)
--- PASS: TestAccBatchJobDefinition_tags_AddOnUpdate (122.90s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace (123.39s)
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (106.30s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnCreate (139.45s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnCreate (66.96s)
--- PASS: TestAccBatchJobDefinition_propagateTags (35.62s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag (58.60s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag (58.06s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyProviderOnlyTag (54.30s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag (51.37s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (50.14s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (47.02s)
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add (170.00s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_overlapping (180.03s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping (180.77s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (42.61s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (41.61s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace (85.75s)
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_DefaultTag (103.04s)
--- PASS: TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add (81.91s)
--- PASS: TestAccBatchJobDefinition_disappears (25.75s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (31.54s)
--- PASS: TestAccBatchJobDefinition_tags_IgnoreTags_Overlap_ResourceTag (115.27s)
--- PASS: TestAccBatchJobDefinition_tags (197.31s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_providerOnly (136.96s)
--- PASS: TestAccBatchJobDefinition_attributes (53.07s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_minorUpdate (90.70s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (108.79s)

internal/service/batch/job_definition_test.go Outdated Show resolved Hide resolved
internal/service/batch/job_definition.go Show resolved Hide resolved
@ewbankkit ewbankkit merged commit f8a7382 into main Oct 21, 2024
35 checks passed
@ewbankkit ewbankkit deleted the b-aws_batch_job_definition-new-revision-with-tags branch October 21, 2024 20:27
@github-actions github-actions bot added this to the v5.73.0 milestone Oct 21, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Oct 21, 2024
@andrewmwilson
Copy link

Thanks so much for fixing this @ewbankkit!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 24, 2024
Copy link

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

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. service/batch Issues and PRs that pertain to the batch service. tags Pertains to resource tagging. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
3 participants