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: Fix for ARN updating #37111

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Apr 25, 2024

Description

There is a challenge determining if the Job Definition needs to be updated. This is the cost of not forcing new when updates to one argument (eg, container_properties) simultaneously impact a computed attribute (eg, arn). This is a similar situation faced with Lambda Function but Job Definition seems more difficult in determining when a change will cause a revision. The real tricky challenge here is that we have to figure out if a change is GOING to cause a new revision to be created, without the benefit of AWS just telling us. This is necessary because waiting until after AWS tells us is too late, and practitioners will need to refresh or worse, get an inconsistent plan. BUT, if we SetNewComputed without a change, we'll get a testing error: "the non-refresh plan was not empty".

Relations

Closes #36894
Closes #36824
Closes #36865
Relates #35149

References

Output from Acceptance Testing

% make t T=TestAccBatchJobDefinition K=batch P=11 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/batch/... -v -count 1 -parallel 11 -run='TestAccBatchJobDefinition'  -timeout 360m
=== 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_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_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
=== CONT  TestAccBatchJobDefinitionDataSource_basicName
=== CONT  TestAccBatchJobDefinition_basic
=== CONT  TestAccBatchJobDefinition_ContainerProperties_EmptyField
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_null
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnCreate
=== CONT  TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag (28.68s)
=== CONT  TestAccBatchJobDefinition_tags_AddOnUpdate
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nullOverlappingResourceTag (29.93s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_emptyResourceTag (31.04s)
=== CONT  TestAccBatchJobDefinition_tags
--- PASS: TestAccBatchJobDefinition_ContainerProperties_EmptyField (32.03s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_fargate
--- PASS: TestAccBatchJobDefinition_basic (32.06s)
=== CONT  TestAccBatchJobDefinition_propagateTags
--- PASS: TestAccBatchJobDefinition_tags_null (40.87s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_minorUpdate
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToResourceOnly (44.65s)
=== CONT  TestAccBatchJobDefinition_ContainerProperties_advanced
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Replace (50.96s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_update
--- PASS: TestAccBatchJobDefinitionDataSource_basicName (54.38s)
=== CONT  TestAccBatchJobDefinition_schedulingPriority
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN_EKSProperties (24.71s)
=== CONT  TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties
--- PASS: TestAccBatchJobDefinition_propagateTags (24.01s)
=== CONT  TestAccBatchJobDefinition_createTypeContainerWithNodeProperties
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnCreate (56.10s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_overlapping
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_fargate (29.82s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccBatchJobDefinition_createTypeMultiNodeWithContainerProperties (8.42s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilities_ec2
--- PASS: TestAccBatchJobDefinition_createTypeContainerWithNodeProperties (8.33s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties
--- PASS: TestAccBatchJobDefinition_tags_EmptyTag_OnUpdate_Add (73.20s)
=== CONT  TestAccBatchJobDefinitionDataSource_basicARN
--- PASS: TestAccBatchJobDefinition_tags_AddOnUpdate (47.59s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping
--- PASS: TestAccBatchJobDefinition_schedulingPriority (30.08s)
=== CONT  TestAccBatchJobDefinition_tags_DefaultTags_providerOnly
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN_NodeProperties (25.39s)
=== CONT  TestAccBatchJobDefinition_disappears
--- PASS: TestAccBatchJobDefinition_PlatformCapabilities_ec2 (32.28s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_advanced
--- PASS: TestAccBatchJobDefinition_EKSProperties_update (50.55s)
=== CONT  TestAccBatchJobDefinition_EKSProperties_basic
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_updateToProviderOnly (49.12s)
=== CONT  TestAccBatchJobDefinition_attributes
--- PASS: TestAccBatchJobDefinition_disappears (28.69s)
=== CONT  TestAccBatchJobDefinition_NodeProperties_basic
--- PASS: TestAccBatchJobDefinitionDataSource_basicARN (48.69s)
=== CONT  TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults
--- PASS: TestAccBatchJobDefinition_EKSProperties_basic (34.81s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_overlapping (81.27s)
--- PASS: TestAccBatchJobDefinition_tags (110.28s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_advanced (52.26s)
--- PASS: TestAccBatchJobDefinition_NodeProperties_basic (32.93s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_minorUpdate (111.97s)
--- PASS: TestAccBatchJobDefinition_PlatformCapabilitiesFargate_containerPropertiesDefaults (32.30s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_nonOverlapping (79.74s)
--- PASS: TestAccBatchJobDefinition_ContainerProperties_advanced (126.83s)
--- PASS: TestAccBatchJobDefinition_tags_DefaultTags_providerOnly (88.53s)
--- PASS: TestAccBatchJobDefinition_attributes (68.34s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/batch	181.831s

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/M Managed by automation to categorize the size of a PR. service/batch Issues and PRs that pertain to the batch service. labels Apr 25, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 25, 2024
Copy link

Thank you for your contribution! 🚀

A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored.

For additional information refer to the AWS SDK for Go Versions page in the contributor guide.

@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. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 25, 2024
@YakDriver YakDriver merged commit 92000ec into main Apr 25, 2024
44 checks passed
@YakDriver YakDriver deleted the b-batch-job-definition-arn-updates branch April 25, 2024 23:41
@github-actions github-actions bot added this to the v5.47.0 milestone Apr 25, 2024
github-actions bot pushed a commit that referenced this pull request Apr 25, 2024
Copy link

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

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 26, 2024
t0yv0 added a commit to pulumi/pulumi-aws that referenced this pull request May 2, 2024
Recent changes in hashicorp/terraform-provider-aws#37111 introduced a Diff customizer that leads to errors in the Pulumi
version of the provider due to discrepancies in the order in which Diff customizer functions are applied between Pulumi
and Terraform. This change fixes the problem by applying the experimental PlanResourceChange flag to the affected
resource.

A regression test is included.

See also: pulumi/pulumi-terraform-bridge#1785
t0yv0 added a commit to pulumi/pulumi-aws that referenced this pull request May 2, 2024
…3888)

Recent changes in hashicorp/terraform-provider-aws#37111 introduced a
Diff customizer that leads to errors in the Pulumi version of the
provider due to discrepancies in the order in which Diff customizer
functions are applied between Pulumi and Terraform. This change fixes
the problem by applying the experimental PlanResourceChange flag to the
affected resource.

Fixes #3887

A regression test is included.

See also: pulumi/pulumi-terraform-bridge#1785
Copy link

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 27, 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. 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
1 participant