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: Fix policy_version inconsistent result after apply error for aws_opensearchserverless_lifecycle_policy and aws_opensearchserverless_security_policy #39528

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented Sep 28, 2024

Description

This PR fixes an issue where the policy_version for the aws_opensearchserverless_lifecycle_policy resource and the aws_opensearchserverless_security_policy resource produces an inconsistent value after apply on update. It seems that the UseStateForUnknown modifier requires that the value be the same before and after apply. Instead of using this, manually setting the API input value using the state value seems to resolve the issue.

Relations

Closes #39527

References

n/a

Output from Acceptance Testing

$ make testacc TESTS="TestAccOpenSearchServerlessLifecyclePolicy_|TestAccOpenSearchServerlessSecurityPolicy_" PKG=opensearchserverless      
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.1 test ./internal/service/opensearchserverless/... -v -count 1 -parallel 20 -run='TestAccOpenSearchServerlessLifecyclePolicy_|TestAccOpenSearchServerlessSecurityPolicy_'  -timeout 360m
=== RUN   TestAccOpenSearchServerlessLifecyclePolicy_basic
=== PAUSE TestAccOpenSearchServerlessLifecyclePolicy_basic
=== RUN   TestAccOpenSearchServerlessLifecyclePolicy_disappears
=== PAUSE TestAccOpenSearchServerlessLifecyclePolicy_disappears
=== RUN   TestAccOpenSearchServerlessLifecyclePolicy_update
=== PAUSE TestAccOpenSearchServerlessLifecyclePolicy_update
=== RUN   TestAccOpenSearchServerlessSecurityPolicy_basic
=== PAUSE TestAccOpenSearchServerlessSecurityPolicy_basic
=== RUN   TestAccOpenSearchServerlessSecurityPolicy_update
=== PAUSE TestAccOpenSearchServerlessSecurityPolicy_update
=== RUN   TestAccOpenSearchServerlessSecurityPolicy_disappears
=== PAUSE TestAccOpenSearchServerlessSecurityPolicy_disappears
=== RUN   TestAccOpenSearchServerlessSecurityPolicy_string
=== PAUSE TestAccOpenSearchServerlessSecurityPolicy_string
=== RUN   TestAccOpenSearchServerlessSecurityPolicy_stringUpdate
=== PAUSE TestAccOpenSearchServerlessSecurityPolicy_stringUpdate
=== CONT  TestAccOpenSearchServerlessLifecyclePolicy_basic
=== CONT  TestAccOpenSearchServerlessSecurityPolicy_update
=== CONT  TestAccOpenSearchServerlessSecurityPolicy_basic
=== CONT  TestAccOpenSearchServerlessSecurityPolicy_string
=== CONT  TestAccOpenSearchServerlessSecurityPolicy_stringUpdate
=== CONT  TestAccOpenSearchServerlessLifecyclePolicy_update
=== CONT  TestAccOpenSearchServerlessSecurityPolicy_disappears
=== CONT  TestAccOpenSearchServerlessLifecyclePolicy_disappears
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_disappears (24.16s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_disappears (24.30s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_basic (26.47s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_basic (27.27s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_string (33.26s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_stringUpdate (36.10s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_update (36.18s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_update (36.24s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/opensearchserverless       36.543s

$

@acwwat acwwat requested a review from a team as a code owner September 28, 2024 21:50
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 service/opensearchserverless Issues and PRs that pertain to the opensearchserverless service. needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Sep 28, 2024
@acwwat acwwat force-pushed the b-aws_opensearchserverless_security_policy-fix_policy_version_inconsistent_value branch 2 times, most recently from f602573 to 165d248 Compare September 28, 2024 21:56
@acwwat acwwat changed the title fix: Fix policy_result inconsistent value after apply issue for aws_opensearchserverless_security_policy fix: Fix policy_version inconsistent result after apply error for aws_opensearchserverless_security_policy Sep 28, 2024
@acwwat acwwat changed the title fix: Fix policy_version inconsistent result after apply error for aws_opensearchserverless_security_policy fix: Fix policy_version inconsistent result after apply error for aws_opensearchserverless_lifecycle_policy and aws_opensearchserverless_security_policy Sep 28, 2024
@acwwat acwwat force-pushed the b-aws_opensearchserverless_security_policy-fix_policy_version_inconsistent_value branch from 165d248 to d5e62eb Compare September 28, 2024 22:11
@acwwat acwwat force-pushed the b-aws_opensearchserverless_security_policy-fix_policy_version_inconsistent_value branch from d5e62eb to b3d5cb8 Compare September 28, 2024 22:33
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 30, 2024
@jar-b jar-b self-assigned this Sep 30, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 30, 2024
Copy link
Member

@jar-b jar-b 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 PKG=opensearchserverless TESTS="TestAccOpenSearchServerlessLifecyclePolicy_|TestAccOpenSearchServerlessSecurityPolicy_"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.1 test ./internal/service/opensearchserverless/... -v -count 1 -parallel 20 -run='TestAccOpenSearchServerlessLifecyclePolicy_|TestAccOpenSearchServerlessSecurityPolicy_'  -timeout 360m

--- PASS: TestAccOpenSearchServerlessSecurityPolicy_disappears (18.74s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_disappears (18.76s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_basic (20.82s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_basic (21.15s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_string (25.25s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_stringUpdate (26.11s)
--- PASS: TestAccOpenSearchServerlessLifecyclePolicy_update (26.75s)
--- PASS: TestAccOpenSearchServerlessSecurityPolicy_update (26.77s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/opensearchserverless       32.293s

@jar-b
Copy link
Member

jar-b commented Sep 30, 2024

Thanks for your contribution, @acwwat! 👍

@jar-b jar-b merged commit aec0cc2 into hashicorp:main Sep 30, 2024
56 checks passed
@github-actions github-actions bot added this to the v5.70.0 milestone Sep 30, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

This functionality has been released in v5.70.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. external-maintainer Contribution from a trusted external contributor. service/opensearchserverless Issues and PRs that pertain to the opensearchserverless service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_opensearchserverless_security_policy provider inconsistency
3 participants