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

bugfix/treat empty secretOptions as null to prevent batch_job_definition recreation every time #16120

Merged
merged 3 commits into from
Apr 19, 2021
Merged

bugfix/treat empty secretOptions as null to prevent batch_job_definition recreation every time #16120

merged 3 commits into from
Apr 19, 2021

Conversation

philnichol
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates #13629
Relates #11998
Closes #16014

Release note for CHANGELOG:

NONE

Output from acceptance testing:

Before updating the acceptance test:

$ TF_ACC=1 go test ./aws/internal/service/batch/equivalency -v -count 1 -parallel 4 -run=TestEquivalentBatchContainerPropertiesJSON
=== RUN   TestEquivalentBatchContainerPropertiesJSON
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_ResourceRequirements
=== RUN   TestEquivalentBatchContainerPropertiesJSON/reordered_Environment
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_environment,_mountPoints,_ulimits,_and_volumes
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_command,_mountPoints,_resourceRequirements,_secrets,_ulimits,_volumes
--- PASS: TestEquivalentBatchContainerPropertiesJSON (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_ResourceRequirements (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/reordered_Environment (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_environment,_mountPoints,_ulimits,_and_volumes (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_command,_mountPoints,_resourceRequirements,_secrets,_ulimits,_volumes (0.00s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws/internal/service/batch/equivalency    0.006s

After updating the acceptance test:

$ TF_ACC=1 go test ./aws/internal/service/batch/equivalency -v -count 1 -parallel 4 -run=TestEquivalentBatchContainerPropertiesJSON
=== RUN   TestEquivalentBatchContainerPropertiesJSON
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_ResourceRequirements
=== RUN   TestEquivalentBatchContainerPropertiesJSON/reordered_Environment
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_environment,_mountPoints,_ulimits,_and_volumes
=== RUN   TestEquivalentBatchContainerPropertiesJSON/empty_command,_logConfiguration.secretOptions,_mountPoints,_resourceRequirements,_secrets,_ulimits,_volumes
--- PASS: TestEquivalentBatchContainerPropertiesJSON (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_ResourceRequirements (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/reordered_Environment (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_environment,_mountPoints,_ulimits,_and_volumes (0.00s)
    --- PASS: TestEquivalentBatchContainerPropertiesJSON/empty_command,_logConfiguration.secretOptions,_mountPoints,_resourceRequirements,_secrets,_ulimits,_volumes (0.00s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws/internal/service/batch/equivalency    0.005s

Resource acceptance test:

$ TF_ACC=1 go test ./aws -v -count 1 -parallel 5 -run=TestAccAWSBatchJobDefinition_
=== RUN   TestAccAWSBatchJobDefinition_basic
=== PAUSE TestAccAWSBatchJobDefinition_basic
=== RUN   TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== PAUSE TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== RUN   TestAccAWSBatchJobDefinition_updateForcesNewResource
=== PAUSE TestAccAWSBatchJobDefinition_updateForcesNewResource
=== RUN   TestAccAWSBatchJobDefinition_Tags
=== PAUSE TestAccAWSBatchJobDefinition_Tags
=== CONT  TestAccAWSBatchJobDefinition_basic
=== CONT  TestAccAWSBatchJobDefinition_Tags
=== CONT  TestAccAWSBatchJobDefinition_updateForcesNewResource
=== CONT  TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
--- PASS: TestAccAWSBatchJobDefinition_ContainerProperties_Advanced (14.78s)
--- PASS: TestAccAWSBatchJobDefinition_basic (15.13s)
--- PASS: TestAccAWSBatchJobDefinition_updateForcesNewResource (24.80s)
--- PASS: TestAccAWSBatchJobDefinition_Tags (38.20s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       38.239s

@philnichol philnichol requested a review from a team as a code owner November 10, 2020 16:50
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/batch Issues and PRs that pertain to the batch service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 10, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 10, 2020
Base automatically changed from master to main January 23, 2021 00:59
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Apr 19, 2021
Acceptance test output:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchJobDefinition_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchJobDefinition_ -timeout 180m
=== RUN   TestAccAWSBatchJobDefinition_basic
=== PAUSE TestAccAWSBatchJobDefinition_basic
=== RUN   TestAccAWSBatchJobDefinition_disappears
=== PAUSE TestAccAWSBatchJobDefinition_disappears
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== RUN   TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== PAUSE TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== RUN   TestAccAWSBatchJobDefinition_updateForcesNewResource
=== PAUSE TestAccAWSBatchJobDefinition_updateForcesNewResource
=== RUN   TestAccAWSBatchJobDefinition_Tags
=== PAUSE TestAccAWSBatchJobDefinition_Tags
=== RUN   TestAccAWSBatchJobDefinition_PropagateTags
=== PAUSE TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_basic
=== CONT  TestAccAWSBatchJobDefinition_updateForcesNewResource
=== CONT  TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== CONT  TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== CONT  TestAccAWSBatchJobDefinition_Tags
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== CONT  TestAccAWSBatchJobDefinition_disappears
--- PASS: TestAccAWSBatchJobDefinition_disappears (13.55s)
--- PASS: TestAccAWSBatchJobDefinition_PropagateTags (15.94s)
--- PASS: TestAccAWSBatchJobDefinition_basic (17.29s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2 (17.59s)
--- PASS: TestAccAWSBatchJobDefinition_ContainerProperties_Advanced (17.83s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate (19.72s)
--- PASS: TestAccAWSBatchJobDefinition_updateForcesNewResource (26.30s)
--- PASS: TestAccAWSBatchJobDefinition_Tags (36.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	39.134s
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Apr 19, 2021
@ewbankkit ewbankkit self-assigned this Apr 19, 2021
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchJobDefinition_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchJobDefinition_ -timeout 180m
=== RUN   TestAccAWSBatchJobDefinition_basic
=== PAUSE TestAccAWSBatchJobDefinition_basic
=== RUN   TestAccAWSBatchJobDefinition_disappears
=== PAUSE TestAccAWSBatchJobDefinition_disappears
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== RUN   TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== PAUSE TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== RUN   TestAccAWSBatchJobDefinition_updateForcesNewResource
=== PAUSE TestAccAWSBatchJobDefinition_updateForcesNewResource
=== RUN   TestAccAWSBatchJobDefinition_Tags
=== PAUSE TestAccAWSBatchJobDefinition_Tags
=== RUN   TestAccAWSBatchJobDefinition_PropagateTags
=== PAUSE TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_basic
=== CONT  TestAccAWSBatchJobDefinition_updateForcesNewResource
=== CONT  TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== CONT  TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== CONT  TestAccAWSBatchJobDefinition_Tags
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== CONT  TestAccAWSBatchJobDefinition_disappears
--- PASS: TestAccAWSBatchJobDefinition_disappears (13.55s)
--- PASS: TestAccAWSBatchJobDefinition_PropagateTags (15.94s)
--- PASS: TestAccAWSBatchJobDefinition_basic (17.29s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2 (17.59s)
--- PASS: TestAccAWSBatchJobDefinition_ContainerProperties_Advanced (17.83s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate (19.72s)
--- PASS: TestAccAWSBatchJobDefinition_updateForcesNewResource (26.30s)
--- PASS: TestAccAWSBatchJobDefinition_Tags (36.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	39.134s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchJobDefinition_'    
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchJobDefinition_ -timeout 180m
=== RUN   TestAccAWSBatchJobDefinition_basic
=== PAUSE TestAccAWSBatchJobDefinition_basic
=== RUN   TestAccAWSBatchJobDefinition_disappears
=== PAUSE TestAccAWSBatchJobDefinition_disappears
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== RUN   TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== PAUSE TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== RUN   TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== PAUSE TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== RUN   TestAccAWSBatchJobDefinition_updateForcesNewResource
=== PAUSE TestAccAWSBatchJobDefinition_updateForcesNewResource
=== RUN   TestAccAWSBatchJobDefinition_Tags
=== PAUSE TestAccAWSBatchJobDefinition_Tags
=== RUN   TestAccAWSBatchJobDefinition_PropagateTags
=== PAUSE TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_basic
=== CONT  TestAccAWSBatchJobDefinition_updateForcesNewResource
=== CONT  TestAccAWSBatchJobDefinition_PropagateTags
=== CONT  TestAccAWSBatchJobDefinition_ContainerProperties_Advanced
=== CONT  TestAccAWSBatchJobDefinition_Tags
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2
=== CONT  TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate
=== CONT  TestAccAWSBatchJobDefinition_disappears
--- PASS: TestAccAWSBatchJobDefinition_disappears (16.25s)
--- PASS: TestAccAWSBatchJobDefinition_PropagateTags (18.97s)
--- PASS: TestAccAWSBatchJobDefinition_ContainerProperties_Advanced (21.75s)
--- PASS: TestAccAWSBatchJobDefinition_basic (21.81s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_EC2 (25.27s)
--- PASS: TestAccAWSBatchJobDefinition_PlatformCapabilities_Fargate (25.40s)
--- PASS: TestAccAWSBatchJobDefinition_updateForcesNewResource (38.37s)
--- PASS: TestAccAWSBatchJobDefinition_Tags (48.69s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	51.590s

@ewbankkit
Copy link
Contributor

@philnichol Thanks for the contribution 👏.
I took the liberty of adding a CHANGELOG entry file to get this one merged quickly.

@ewbankkit ewbankkit merged commit 7d8b467 into hashicorp:main Apr 19, 2021
@github-actions github-actions bot added this to the v3.38.0 milestone Apr 19, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 3.38.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 for triage. Thanks!

@ghost
Copy link

ghost commented May 20, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

aws_batch_job_definition resource recreated each time on AWS 3.10
2 participants