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

[Bug]: aws_berockagent_agent does not return agent_version #37321

Open
kmcduffee-verisk opened this issue May 7, 2024 · 4 comments
Open

[Bug]: aws_berockagent_agent does not return agent_version #37321

kmcduffee-verisk opened this issue May 7, 2024 · 4 comments
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/bedrockagent Issues and PRs that pertain to the bedrockagent service.

Comments

@kmcduffee-verisk
Copy link

kmcduffee-verisk commented May 7, 2024

Terraform Core Version

1.8.2

AWS Provider Version

5.48.0

Affected Resource(s)

  • aws_bedrockagent_agent
  • aws_bedrockagent_agent_alias

Expected Behavior

When creating or updating the agent, agent_version should be included in the resource attributes. This would then allow for updating an associated aws_bedrockagent_agent_alias to point to the new version.

Actual Behavior

When creating or updating an aws_bedrockagent_agent resource, the agent_version is not returned. This makes it difficult to make changes to an associated aws_bedrockagent_agent_alias resource, as it's not possible to set its routing_configuration block to point to the new version.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_bedrockagent_agent" "demo" {
  agent_name                  = "demo"
  agent_resource_role_arn     = aws_iam_role.demo.arn
  foundation_model            = "anthropic.claude-3-sonnet-20240229-v1:0"
  idle_session_ttl_in_seconds = 60
  instruction = "Just testing."
}
  
output "agent_version" {
  value = aws_bedrockagent_agent.demo.agent_version
}

Steps to Reproduce

  1. Apply included terraform.
  2. Note that agent_version is not returned.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@kmcduffee-verisk kmcduffee-verisk added the bug Addresses a defect in current functionality. label May 7, 2024
@github-actions github-actions bot added the service/bedrockagent Issues and PRs that pertain to the bedrockagent service. label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 7, 2024
@kmcduffee-verisk
Copy link
Author

kmcduffee-verisk commented May 7, 2024

Currently I am solving the alias issue with the following:

resource "aws_bedrockagent_agent_alias" "demo" {
  agent_alias_name = "demo"
  agent_id         = aws_bedrockagent_agent.demo.agent_id
  description      = "Demo"
  routing_configuration {
    agent_version = data.external.latest_agent_version.result.agent_version
  }
}

data "external" "latest_agent_version" {
  program = ["bash","${path.module}/scripts/get_agent_details.sh",aws_bedrockagent_agent.demo.agent_id]
  depends_on = [ aws_bedrockagent_agent.demo ]
}
#!/usr/bin/env bash

AGENT_ID=$1
AGENT_VERSION=$(aws bedrock-agent list-agents --query "agentSummaries[?agentId=='${AGENT_ID}'].latestAgentVersion" --output text)

jq -n --arg agent_version "${AGENT_VERSION}" '{"agent_version":$agent_version}'

@acwwat
Copy link
Contributor

acwwat commented May 7, 2024

Just adding some observations here since I've been experimenting with the Bedrock Agents resources recently.

It seems that the agent_version in the context of aws_bedrockagent_agent is not very helpful because the value is supposedly hardcoded to DRAFT if you look at the API reference. But the actual behavior is also different or changing. I can see that the field is defined in the aws_bedrockagent_agent resource code as a computed attribute but it's being set to null because the AWS API is not returning it! When I called aws bedrock-agent get-agent in the CLI, the response does NOT include the agentVersion field.

It also doesn't help when versions are created only when an alias is created. So what I think we need is a new data source aws_bedrockagent_agent_versions to fetch the available versions for creating an alias pointing to a specific version.

@justinretzolk justinretzolk added prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. and removed needs-triage Waiting for first response or review from a maintainer. labels May 7, 2024
@drewtul
Copy link
Contributor

drewtul commented Aug 19, 2024

Per @acwwat The version for a agent created via aws_bedrockagent_agent is always DRAFT, using aws_bedrockagent_agent_alias without routing_configuration will create a new version of the agent from the currently prepared DRAFT. That appears to be the only way to create a new version at this time.

You can also using the data source in #38792 to look up specific versions if you want to create an aws_bedrockagent_agent_alias to a specific version that already exists.

We should probably deprecate and remove agent_version as the API isn't returning it and it could only be DRAFT it's not providing anything useful.

As it stands I don't think this is a bug we can fix, the CreateAgentAlias API call is the only call that creates new versions of the agent.

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. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/bedrockagent Issues and PRs that pertain to the bedrockagent service.
Projects
None yet
Development

No branches or pull requests

4 participants