From 4f831feab604f7a0ffdc0f5b95ace69e44312781 Mon Sep 17 00:00:00 2001 From: lodgei Date: Fri, 4 Apr 2025 15:22:16 +0000 Subject: [PATCH 1/5] initial commit --- .../bedrock_document_blueprint.tf | 0 .../bedrock_image_blueprint.tf | 0 templates/resources/bedrock_blueprint.md.tmpl | 31 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf create mode 100644 examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf create mode 100644 templates/resources/bedrock_blueprint.md.tmpl diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/templates/resources/bedrock_blueprint.md.tmpl b/templates/resources/bedrock_blueprint.md.tmpl new file mode 100644 index 0000000000..952e8521a2 --- /dev/null +++ b/templates/resources/bedrock_blueprint.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### Custom Blueprints for documents +Create a custom blueprint for intelligent document processing with Bedrock Data Automation +{{ tffile (printf "examples/resources/%s/first_example.tf" .Name)}} + +### Custom Blueprints for images +Create a custom blueprint to define specific fields to identify from images with Bedrock Data Automation +{{ tffile (printf "examples/resources/%s/second_example.tf" .Name)}} + +{{ .SchemaMarkdown | trimspace }} +{{- if .HasImport }} + +## Import + +Import is supported using the following syntax: + +{{ codefile "shell" .ImportFile }} + +{{- end }} \ No newline at end of file From 2af27a9beea35ed3fe54a6126ce36b4a6802b20a Mon Sep 17 00:00:00 2001 From: lodgei Date: Fri, 4 Apr 2025 16:33:26 +0000 Subject: [PATCH 2/5] working document bp --- .../bedrock_document_blueprint.tf | 32 +++++++++++++++++++ .../bedrock_image_blueprint.tf | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf index e69de29bb2..084821bb92 100644 --- a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf +++ b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf @@ -0,0 +1,32 @@ + +resources "awscc_bedrockdataautomation_blueprint" "example" { + blueprint_name = "EXAMPLE" + type = "DOCUMENT" + blueprint_stage = "LIVE" + schema = +} + + +bda_create_blueprint_response = bedrock_data_automation_client.create_blueprint( + blueprintName='CUSTOM_PAYSLIP_BLUEPRINT', + type='DOCUMENT', + blueprintStage='LIVE', + schema=json.dumps({ + '$schema': 'http://json-schema.org/draft-07/schema#', + 'description': 'default', + 'documentClass': 'default', + 'type': 'object', + 'properties': { + 'gross_pay_this_period': { + 'type': 'number', + 'inferenceType': 'extractive', + 'description': 'The gross pay for this pay period from the Earnings table' + }, + 'net_pay': { + 'type': 'number', + 'inferenceType': 'extractive', + 'description': 'The net pay for this pay period from the bottom of the document' + } + } + }), +) \ No newline at end of file diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf index e69de29bb2..084821bb92 100644 --- a/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf +++ b/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf @@ -0,0 +1,32 @@ + +resources "awscc_bedrockdataautomation_blueprint" "example" { + blueprint_name = "EXAMPLE" + type = "DOCUMENT" + blueprint_stage = "LIVE" + schema = +} + + +bda_create_blueprint_response = bedrock_data_automation_client.create_blueprint( + blueprintName='CUSTOM_PAYSLIP_BLUEPRINT', + type='DOCUMENT', + blueprintStage='LIVE', + schema=json.dumps({ + '$schema': 'http://json-schema.org/draft-07/schema#', + 'description': 'default', + 'documentClass': 'default', + 'type': 'object', + 'properties': { + 'gross_pay_this_period': { + 'type': 'number', + 'inferenceType': 'extractive', + 'description': 'The gross pay for this pay period from the Earnings table' + }, + 'net_pay': { + 'type': 'number', + 'inferenceType': 'extractive', + 'description': 'The net pay for this pay period from the bottom of the document' + } + } + }), +) \ No newline at end of file From b38e5b132b9b5b260d71cfb90a280baa475ee051 Mon Sep 17 00:00:00 2001 From: lodgei Date: Fri, 4 Apr 2025 16:45:02 +0000 Subject: [PATCH 3/5] updated blueprints --- .../bedrock_document_blueprint.tf | 47 ++++++++----------- .../bedrock_image_blueprint.tf | 32 ------------- templates/resources/bedrock_blueprint.md.tmpl | 4 -- 3 files changed, 19 insertions(+), 64 deletions(-) delete mode 100644 examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf index 084821bb92..29db722d9c 100644 --- a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf +++ b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf @@ -1,32 +1,23 @@ - -resources "awscc_bedrockdataautomation_blueprint" "example" { - blueprint_name = "EXAMPLE" +resource "awscc_bedrock_blueprint" "example" { + blueprint_name = "example-blueprint" type = "DOCUMENT" - blueprint_stage = "LIVE" - schema = -} - - -bda_create_blueprint_response = bedrock_data_automation_client.create_blueprint( - blueprintName='CUSTOM_PAYSLIP_BLUEPRINT', - type='DOCUMENT', - blueprintStage='LIVE', - schema=json.dumps({ - '$schema': 'http://json-schema.org/draft-07/schema#', - 'description': 'default', - 'documentClass': 'default', - 'type': 'object', - 'properties': { - 'gross_pay_this_period': { - 'type': 'number', - 'inferenceType': 'extractive', - 'description': 'The gross pay for this pay period from the Earnings table' + schema = jsonencode({ + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "default", + "class": "default", + "type": "object", + "definitions": {}, + "properties": { + "gross_pay_this_period": { + "type": "number", + "inferenceType": "explicit", + "instruction": "The gross pay for this pay period from the Earnings table" }, - 'net_pay': { - 'type': 'number', - 'inferenceType': 'extractive', - 'description': 'The net pay for this pay period from the bottom of the document' + "net_pay": { + "type": "number", + "inferenceType": "explicit", + "instruction": "The net pay for this pay period from the bottom of the document" } } - }), -) \ No newline at end of file + }) +} \ No newline at end of file diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf deleted file mode 100644 index 084821bb92..0000000000 --- a/examples/resources/awscc_bedrock_blueprint/bedrock_image_blueprint.tf +++ /dev/null @@ -1,32 +0,0 @@ - -resources "awscc_bedrockdataautomation_blueprint" "example" { - blueprint_name = "EXAMPLE" - type = "DOCUMENT" - blueprint_stage = "LIVE" - schema = -} - - -bda_create_blueprint_response = bedrock_data_automation_client.create_blueprint( - blueprintName='CUSTOM_PAYSLIP_BLUEPRINT', - type='DOCUMENT', - blueprintStage='LIVE', - schema=json.dumps({ - '$schema': 'http://json-schema.org/draft-07/schema#', - 'description': 'default', - 'documentClass': 'default', - 'type': 'object', - 'properties': { - 'gross_pay_this_period': { - 'type': 'number', - 'inferenceType': 'extractive', - 'description': 'The gross pay for this pay period from the Earnings table' - }, - 'net_pay': { - 'type': 'number', - 'inferenceType': 'extractive', - 'description': 'The net pay for this pay period from the bottom of the document' - } - } - }), -) \ No newline at end of file diff --git a/templates/resources/bedrock_blueprint.md.tmpl b/templates/resources/bedrock_blueprint.md.tmpl index 952e8521a2..1ecba35823 100644 --- a/templates/resources/bedrock_blueprint.md.tmpl +++ b/templates/resources/bedrock_blueprint.md.tmpl @@ -15,10 +15,6 @@ description: |- Create a custom blueprint for intelligent document processing with Bedrock Data Automation {{ tffile (printf "examples/resources/%s/first_example.tf" .Name)}} -### Custom Blueprints for images -Create a custom blueprint to define specific fields to identify from images with Bedrock Data Automation -{{ tffile (printf "examples/resources/%s/second_example.tf" .Name)}} - {{ .SchemaMarkdown | trimspace }} {{- if .HasImport }} From 4bcd1049dbf39183d64dd2660e0b89219b507b1d Mon Sep 17 00:00:00 2001 From: lodgei Date: Fri, 4 Apr 2025 16:56:21 +0000 Subject: [PATCH 4/5] make docs --- docs/resources/bedrock_blueprint.md | 33 +++++++++++++-- .../bedrock_document_blueprint.tf | 42 +++++++++---------- templates/resources/bedrock_blueprint.md.tmpl | 2 +- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/docs/resources/bedrock_blueprint.md b/docs/resources/bedrock_blueprint.md index c0440fd11c..28544ac12d 100644 --- a/docs/resources/bedrock_blueprint.md +++ b/docs/resources/bedrock_blueprint.md @@ -1,5 +1,4 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "awscc_bedrock_blueprint Resource - terraform-provider-awscc" subcategory: "" description: |- @@ -10,7 +9,35 @@ description: |- Definition of AWS::Bedrock::Blueprint Resource Type - +## Example Usage + +### Custom Blueprints for documents +Create a custom blueprint for intelligent document processing with Bedrock Data Automation +```terraform +resource "awscc_bedrock_blueprint" "example" { + blueprint_name = "example-blueprint" + type = "DOCUMENT" + schema = jsonencode({ + "$schema" : "http://json-schema.org/draft-07/schema#", + "description" : "default", + "class" : "default", + "type" : "object", + "definitions" : {}, + "properties" : { + "gross_pay_this_period" : { + "type" : "number", + "inferenceType" : "explicit", + "instruction" : "The gross pay for this pay period from the Earnings table" + }, + "net_pay" : { + "type" : "number", + "inferenceType" : "explicit", + "instruction" : "The net pay for this pay period from the bottom of the document" + } + } + }) +} +``` ## Schema @@ -49,4 +76,4 @@ Import is supported using the following syntax: ```shell $ terraform import awscc_bedrock_blueprint.example "blueprint_arn" -``` +``` \ No newline at end of file diff --git a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf index 29db722d9c..839dc5bd0c 100644 --- a/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf +++ b/examples/resources/awscc_bedrock_blueprint/bedrock_document_blueprint.tf @@ -1,23 +1,23 @@ resource "awscc_bedrock_blueprint" "example" { - blueprint_name = "example-blueprint" - type = "DOCUMENT" - schema = jsonencode({ - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "default", - "class": "default", - "type": "object", - "definitions": {}, - "properties": { - "gross_pay_this_period": { - "type": "number", - "inferenceType": "explicit", - "instruction": "The gross pay for this pay period from the Earnings table" - }, - "net_pay": { - "type": "number", - "inferenceType": "explicit", - "instruction": "The net pay for this pay period from the bottom of the document" - } - } - }) + blueprint_name = "example-blueprint" + type = "DOCUMENT" + schema = jsonencode({ + "$schema" : "http://json-schema.org/draft-07/schema#", + "description" : "default", + "class" : "default", + "type" : "object", + "definitions" : {}, + "properties" : { + "gross_pay_this_period" : { + "type" : "number", + "inferenceType" : "explicit", + "instruction" : "The gross pay for this pay period from the Earnings table" + }, + "net_pay" : { + "type" : "number", + "inferenceType" : "explicit", + "instruction" : "The net pay for this pay period from the bottom of the document" + } + } + }) } \ No newline at end of file diff --git a/templates/resources/bedrock_blueprint.md.tmpl b/templates/resources/bedrock_blueprint.md.tmpl index 1ecba35823..dc5b8cffc2 100644 --- a/templates/resources/bedrock_blueprint.md.tmpl +++ b/templates/resources/bedrock_blueprint.md.tmpl @@ -13,7 +13,7 @@ description: |- ### Custom Blueprints for documents Create a custom blueprint for intelligent document processing with Bedrock Data Automation -{{ tffile (printf "examples/resources/%s/first_example.tf" .Name)}} +{{ tffile (printf "examples/resources/%s/bedrock_document_blueprint.tf" .Name)}} {{ .SchemaMarkdown | trimspace }} {{- if .HasImport }} From 959f40b33e80ec6532cbf1c4ac259c35297408ba Mon Sep 17 00:00:00 2001 From: Ian Lodge <135351711+professional-ian@users.noreply.github.com> Date: Fri, 18 Apr 2025 09:29:30 -0400 Subject: [PATCH 5/5] Update tags --- docs/resources/bedrock_blueprint.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/resources/bedrock_blueprint.md b/docs/resources/bedrock_blueprint.md index 28544ac12d..3a22793751 100644 --- a/docs/resources/bedrock_blueprint.md +++ b/docs/resources/bedrock_blueprint.md @@ -36,6 +36,10 @@ resource "awscc_bedrock_blueprint" "example" { } } }) + tags = [{ + key = "ModifiedBy" + value = "AWSCC" + }] } ``` @@ -76,4 +80,4 @@ Import is supported using the following syntax: ```shell $ terraform import awscc_bedrock_blueprint.example "blueprint_arn" -``` \ No newline at end of file +```