Skip to content

Fix inconsistent result error in aws_bedrockagent_agent_alias routing_configuration #43411

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cmmo
Copy link

@cmmo cmmo commented Jul 16, 2025

Description

Fixes issue where aws_bedrockagent_agent_alias produces inconsistent result when routing_configuration.agent_version changes from null to string after apply.

Problem

When routing_configuration is not specified or agent_version is explicitly set to null, AWS automatically assigns a default agent_version (like "37" or "24"). The provider was reading this value back into state, causing inconsistency with the user's configuration.

Solution

  • Preserve the original plan's null state for routing_configuration
  • Maintain consistency between plan and state when values are not explicitly configured
  • Enhanced handling in Create, Read, and Update methods

Testing

  • Added TestAccBedrockAgentAgentAlias_routingConfigurationNull
  • Added TestAccBedrockAgentAgentAlias_routingConfigurationExplicitNull
  • Verified existing tests continue to pass

Relations

Closes #43406.

Output from Acceptance Testing

% make testacc TESTS=TestAccBedrockAgentAgentAlias_routingConfiguration PKG=bedrockagent
# Tests would be run here by maintainers

When routing_configuration is not specified or agent_version is null,
AWS returns a default agent_version (e.g., "37", "24") which was
being read back into Terraform state, causing inconsistent result errors.

This fix preserves the original plan's null state for routing_configuration
when it was not explicitly configured, preventing the inconsistency while
maintaining backward compatibility.

Changes:
- Create: Preserve null routing_configuration from plan
- Read: Maintain consistency with original null state
- Update: Enhanced handling of null/unknown routing configuration
- Tests: Added comprehensive test coverage for both scenarios
@cmmo cmmo requested a review from a team as a code owner July 16, 2025 12:28
Copy link
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

Copy link
Contributor

github-actions bot commented Jul 16, 2025

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/bedrockagent Issues and PRs that pertain to the bedrockagent service. size/M Managed by automation to categorize the size of a PR. labels Jul 16, 2025
@drewtul
Copy link
Contributor

drewtul commented Jul 18, 2025

Unfortunately we can't validate the agent_version inside routing_configuration, null is not a valid value, technically it should be optional and computed.

Returning null to the user I don't think is correct either, we should reject the null and return the computed agent_version as it is never null.

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 21, 2025
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/bedrockagent Issues and PRs that pertain to the bedrockagent service. size/M 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_bedrockagent_agent_alias produces inconsistent result: routing_configuration.agent_version changes from null to string after apply
3 participants