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: ECS EFS volume transit_encryption_port default value causing unwanted diff #34020

Merged

Conversation

kgns
Copy link
Contributor

@kgns kgns commented Oct 20, 2023

Description

This bug has been "bugging" me for a while. I think #19549 and #23541 are both also related to this.

When we omit transit_encryption_port attribute for a efs_volume_configuration block in a aws_ecs_task_definition resource, its value is saved as null in the state file, but AWS API returns 0 when queried. In the ECS documentation it can also be seen 0 is the default value for this field. So I have set 0 as the default value, and also changed the validation function to IsPortNumberOrZero so we can either avoid it and let it default to 0, or we can explicitly set it to 0, and there will not be any diff between what AWS returns and what we have in the state file.

As far as I can remember, this bug never forced any replacements on the task definition by itself, but was only visible when it was accompanied with another change.

Relations

Closes #19549
Closes #23541

References

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-definition-template.html

Output from Acceptance Testing

% make testacc TESTS=TestAccECSTaskDefinition_EFSVolume PKG=ecs
==> Checking that code complies with gofmt requirements...
xargs: gofmt: No such file or directory
TF_ACC=1 go test ./internal/service/ecs/... -v -count 1 -parallel 20 -run='TestAccECSTaskDefinition_EFSVolume'  -timeout 360m
=== RUN   TestAccECSTaskDefinition_EFSVolume_minimal
=== PAUSE TestAccECSTaskDefinition_EFSVolume_minimal
=== RUN   TestAccECSTaskDefinition_EFSVolume_basic
=== PAUSE TestAccECSTaskDefinition_EFSVolume_basic
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== RUN   TestAccECSTaskDefinition_EFSVolume_accessPoint
=== PAUSE TestAccECSTaskDefinition_EFSVolume_accessPoint
=== CONT  TestAccECSTaskDefinition_EFSVolume_minimal
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== CONT  TestAccECSTaskDefinition_EFSVolume_accessPoint
=== CONT  TestAccECSTaskDefinition_EFSVolume_basic
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled (54.18s)
--- PASS: TestAccECSTaskDefinition_EFSVolume_basic (54.21s)
--- PASS: TestAccECSTaskDefinition_EFSVolume_minimal (54.22s)
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryption (54.22s)
--- PASS: TestAccECSTaskDefinition_EFSVolume_accessPoint (55.13s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ecs        55.204s

@github-actions
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. documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service. provider Pertains to the provider itself, rather than any interaction with AWS. labels Oct 20, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 20, 2023
@github-actions
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 @kgns 👋

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

@ewbankkit ewbankkit removed provider Pertains to the provider itself, rather than any interaction with AWS. needs-triage Waiting for first response or review from a maintainer. labels Oct 20, 2023
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 🚀.

% make testacc TESTARGS='-run=TestAccECSTaskDefinition_EFSVolume' PKG=ecs ACCTEST_PARALLELISM=2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ecs/... -v -count 1 -parallel 2  -run=TestAccECSTaskDefinition_EFSVolume -timeout 360m
=== RUN   TestAccECSTaskDefinition_EFSVolume_minimal
=== PAUSE TestAccECSTaskDefinition_EFSVolume_minimal
=== RUN   TestAccECSTaskDefinition_EFSVolume_basic
=== PAUSE TestAccECSTaskDefinition_EFSVolume_basic
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== RUN   TestAccECSTaskDefinition_EFSVolume_accessPoint
=== PAUSE TestAccECSTaskDefinition_EFSVolume_accessPoint
=== CONT  TestAccECSTaskDefinition_EFSVolume_minimal
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryption
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryption (35.01s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_accessPoint
--- PASS: TestAccECSTaskDefinition_EFSVolume_minimal (35.03s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled (34.42s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
--- PASS: TestAccECSTaskDefinition_EFSVolume_accessPoint (38.21s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_basic
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal (33.60s)
--- PASS: TestAccECSTaskDefinition_EFSVolume_basic (32.86s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecs	111.519s

@ewbankkit
Copy link
Contributor

@kgns Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 1310732 into hashicorp:main Oct 20, 2023
34 checks passed
@github-actions github-actions bot added this to the v5.23.0 milestone Oct 20, 2023
@github-actions
Copy link

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

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 Nov 26, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
3 participants