Skip to content

prompt_override_configuration causes "The provider produces an invalid plan" error #12

Open
@mervintankw

Description

@mervintankw

Terraform Core Version

0.13.7

AWS Provider Version

5.76.0

Affected Resource(s)

  • aws_bedrockagent_agent

Expected Behavior

The provider should accept the prompt_override_configuration block and create the Bedrock agent with the specified prompt configurations.

Actual Behavior

The provider produces an invalid plan with a type mismatch between the configuration and the planned value.

Relevant Error/Panic Output Snippet

resource "aws_bedrockagent_agent" "agent" {
  prompt_override_configuration {
    prompt_configurations = [{
      base_prompt_template = "test"
      inference_configuration = [{
        max_length     = 2048
        stop_sequences = ["\n\nHuman:"]
        temperature    = 0
        top_k         = 250
        top_p         = 1
      }]
      parser_mode          = "DEFAULT"
      prompt_creation_mode = "OVERRIDDEN"
      prompt_state        = "ENABLED"
      prompt_type         = "POST_PROCESSING"
    }]
  }
}

Terraform Configuration Files

resource "aws_bedrockagent_agent" "agent" {
  prompt_override_configuration {
    prompt_configurations = [{
      base_prompt_template = "test"
      inference_configuration = [{
        max_length     = 2048
        stop_sequences = ["\n\nHuman:"]
        temperature    = 0
        top_k         = 250
        top_p         = 1
      }]
      parser_mode          = "DEFAULT"
      prompt_creation_mode = "OVERRIDDEN"
      prompt_state        = "ENABLED"
      prompt_type         = "POST_PROCESSING"
    }]
  }
}

Steps to Reproduce

  1. Create a new directory and initialize Terraform:
mkdir bedrock-agent-test
cd bedrock-agent-test
terraform init
  1. Create a main.tf file with the following minimal configuration:
provider "aws" {
  region = "us-east-1"  # or your preferred region
}

resource "aws_iam_role" "agent_role" {
  name = "bedrock-agent-test-role"
  
  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Action = "sts:AssumeRole"
        Effect = "Allow"
        Principal = {
          Service = "bedrock.amazonaws.com"
        }
      }
    ]
  })
}

resource "aws_bedrockagent_agent" "agent" {
  agent_name              = "test-agent"
  agent_resource_role_arn = aws_iam_role.agent_role.arn
  instruction            = "You are a helpful assistant"
  foundation_model      = "anthropic.claude-v2"

  prompt_override_configuration {
    prompt_configurations = [{
      base_prompt_template = "test"
      inference_configuration = [{
        max_length     = 2048
        stop_sequences = ["\n\nHuman:"]
        temperature    = 0
        top_k         = 250
        top_p         = 1
      }]
      parser_mode          = "DEFAULT"
      prompt_creation_mode = "OVERRIDDEN"
      prompt_state        = "ENABLED"
      prompt_type         = "POST_PROCESSING"
    }]
  }
}
  1. Run terraform commands:
terraform init
terraform plan
  1. Observe the error:
Error: Provider produced invalid plan

Provider "registry.terraform.io/hashicorp/aws" planned an invalid value for
aws_bedrockagent_agent.agent.prompt_override_configuration...

Environment Details

  • Terraform Version: x.x.x (output of terraform version)
  • AWS Provider Version: x.x.x
  • Operating System: Your OS
  • AWS Region: Your Region

Prerequisites

  • AWS account with appropriate permissions
  • AWS credentials configured
  • Bedrock service enabled in your AWS account

Debug Output

Error: Provider produced invalid plan

Provider "registry.terraform.io/hashicorp/aws" planned an invalid value for
aws_bedrockagent_agent.agent.prompt_override_configuration...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions