hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

[Bug]: aws_bedrockagent_agent "instruction" attribute validator max should be changed from 4000 to 8000 #40236

Open jsermersheim-hv opened 4 days ago

jsermersheim-hv commented 4 days ago

Terraform Core Version

1.6.6

AWS Provider Version

5.76.0

Affected Resource(s)

validation currently throws the following error for instruction lengths greater than 4000. "Attribute instruction string length must be between 40 and 4000, got: 4036"

Amazon increased the agent instruction limit to 8000 characters. The validator needs to be updated.

image

While the above screenshot shows the AWS Service Quota indicating 8000 characters, the AWS API reference documentation seems to lag behind at 4000 characters:

https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgent.html#bedrock-agent_CreateAgent-request-instruction

Here's the specific code block:

https://github.com/acwwat/terraform-provider-aws/blob/main/internal/service/bedrockagent/agent.go#L127-L135

Expected Behavior

The validator should allow up to 8000 characters

Actual Behavior

validation currently throws the following error for instruction lengths greater than 4000. "Attribute instruction string length must be between 40 and 4000, got: 4036"

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_bedrockagent_agent" "this" {
  agent_name = "agent"
  agent_resource_role_arn = "arn:aws:..."
  foundation_model = var.agent_foundation_model
  instruction = "instructions located here with more than 4000 characters"
}

Steps to Reproduce

You just need to check the validator settings in code and compare to AWS documentation https://docs.aws.amazon.com/bedrock/latest/userguide/quotas.html#quotas-agents

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

stefanfreitag commented 4 days ago

Hi @jsermersheim-hv,

thanks for bringing this to our attention! I checked the service quotas on my end and you are right.

{
    "Quota": {
        "ServiceCode": "bedrock",
        "ServiceName": "Amazon Bedrock",
        "QuotaArn": "arn:aws:servicequotas:eu-central-1:464678460130:bedrock/L-6E3CDA2D",
        "QuotaCode": "L-6E3CDA2D",
        "QuotaName": "Characters in Agent instructions",
        "Value": 8000.0,
        "Unit": "None",
        "Adjustable": true,
        "GlobalQuota": false,
        "QuotaAppliedAtLevel": "ACCOUNT"
    }
}

Let me try to update the code base.