Skip to content

Commit 30d433e

Browse files
committed
feat: Add video_data_delivery_enabled arg for aws_bedrock_model_invocation_logging_configuration
1 parent 16b3f1f commit 30d433e

4 files changed

+91
-25
lines changed

.changelog/41317.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:enhancement
2+
resource/aws_bedrock_model_invocation_logging_configuration: Add `video_data_delivery_enabled` argument
3+
```
4+
5+
```release-note:bug
6+
resource/aws_bedrock_model_invocation_logging_configuration: Set `embedding_data_delivery_enabled`, `image_data_delivery_enabled`, and `text_data_delivery_enabled` arguments as optional with default value of `true`
7+
```

internal/service/bedrock/model_invocation_logging_configuration.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/hashicorp/terraform-plugin-framework/diag"
1414
"github.com/hashicorp/terraform-plugin-framework/resource"
1515
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
16+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
1617
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1718
"github.com/hashicorp/terraform-plugin-framework/types"
1819
"github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag"
@@ -50,20 +51,33 @@ func (r *resourceModelInvocationLoggingConfiguration) Schema(ctx context.Context
5051
},
5152
Attributes: map[string]schema.Attribute{
5253
"embedding_data_delivery_enabled": schema.BoolAttribute{
53-
Required: true,
54+
Optional: true,
55+
Computed: true,
56+
Default: booldefault.StaticBool(true),
5457
},
5558
"image_data_delivery_enabled": schema.BoolAttribute{
56-
Required: true,
59+
Optional: true,
60+
Computed: true,
61+
Default: booldefault.StaticBool(true),
5762
},
5863
"text_data_delivery_enabled": schema.BoolAttribute{
59-
Required: true,
64+
Optional: true,
65+
Computed: true,
66+
Default: booldefault.StaticBool(true),
67+
},
68+
"video_data_delivery_enabled": schema.BoolAttribute{
69+
Optional: true,
70+
Computed: true,
71+
Default: booldefault.StaticBool(true),
6072
},
6173
},
6274
Blocks: map[string]schema.Block{
6375
"cloudwatch_config": schema.SingleNestedBlock{
6476
CustomType: fwtypes.NewObjectTypeOf[cloudWatchConfigModel](ctx),
6577
Attributes: map[string]schema.Attribute{
6678
names.AttrLogGroupName: schema.StringAttribute{
79+
// Must set to optional to avoid validation error
80+
// See: https://github.com/hashicorp/terraform-plugin-framework/issues/740
6781
// Required: true,
6882
Optional: true,
6983
},
@@ -244,6 +258,7 @@ type loggingConfigModel struct {
244258
ImageDataDeliveryEnabled types.Bool `tfsdk:"image_data_delivery_enabled"`
245259
S3Config fwtypes.ObjectValueOf[s3ConfigModel] `tfsdk:"s3_config"`
246260
TextDataDeliveryEnabled types.Bool `tfsdk:"text_data_delivery_enabled"`
261+
VideoDataDeliveryEnabled types.Bool `tfsdk:"video_data_delivery_enabled"`
247262
}
248263

249264
type cloudWatchConfigModel struct {

internal/service/bedrock/model_invocation_logging_configuration_test.go

+29-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,34 @@ func testAccModelInvocationLoggingConfiguration_basic(t *testing.T) {
3333
CheckDestroy: testAccCheckModelInvocationLoggingConfigurationDestroy(ctx),
3434
Steps: []resource.TestStep{
3535
{
36-
Config: testAccModelInvocationLoggingConfigurationConfig_basic(rName),
36+
Config: testAccModelInvocationLoggingConfigurationConfig_basic(rName, "null", "null", "null", "null"),
3737
Check: resource.ComposeAggregateTestCheckFunc(
3838
testAccCheckModelInvocationLoggingConfigurationExists(ctx, resourceName),
3939
resource.TestCheckResourceAttrSet(resourceName, names.AttrID),
4040
resource.TestCheckResourceAttr(resourceName, "logging_config.embedding_data_delivery_enabled", acctest.CtTrue),
4141
resource.TestCheckResourceAttr(resourceName, "logging_config.image_data_delivery_enabled", acctest.CtTrue),
4242
resource.TestCheckResourceAttr(resourceName, "logging_config.text_data_delivery_enabled", acctest.CtTrue),
43+
resource.TestCheckResourceAttr(resourceName, "logging_config.video_data_delivery_enabled", acctest.CtTrue),
44+
resource.TestCheckResourceAttrPair(resourceName, "logging_config.cloudwatch_config.log_group_name", logGroupResourceName, names.AttrName),
45+
resource.TestCheckResourceAttrPair(resourceName, "logging_config.cloudwatch_config.role_arn", iamRoleResourceName, names.AttrARN),
46+
resource.TestCheckResourceAttrPair(resourceName, "logging_config.s3_config.bucket_name", s3BucketResourceName, names.AttrID),
47+
resource.TestCheckResourceAttr(resourceName, "logging_config.s3_config.key_prefix", "bedrock"),
48+
),
49+
},
50+
{
51+
ResourceName: resourceName,
52+
ImportState: true,
53+
ImportStateVerify: true,
54+
},
55+
{
56+
Config: testAccModelInvocationLoggingConfigurationConfig_basic(rName, acctest.CtFalse, acctest.CtFalse, acctest.CtFalse, acctest.CtFalse),
57+
Check: resource.ComposeAggregateTestCheckFunc(
58+
testAccCheckModelInvocationLoggingConfigurationExists(ctx, resourceName),
59+
resource.TestCheckResourceAttrSet(resourceName, names.AttrID),
60+
resource.TestCheckResourceAttr(resourceName, "logging_config.embedding_data_delivery_enabled", acctest.CtFalse),
61+
resource.TestCheckResourceAttr(resourceName, "logging_config.image_data_delivery_enabled", acctest.CtFalse),
62+
resource.TestCheckResourceAttr(resourceName, "logging_config.text_data_delivery_enabled", acctest.CtFalse),
63+
resource.TestCheckResourceAttr(resourceName, "logging_config.video_data_delivery_enabled", acctest.CtFalse),
4364
resource.TestCheckResourceAttrPair(resourceName, "logging_config.cloudwatch_config.log_group_name", logGroupResourceName, names.AttrName),
4465
resource.TestCheckResourceAttrPair(resourceName, "logging_config.cloudwatch_config.role_arn", iamRoleResourceName, names.AttrARN),
4566
resource.TestCheckResourceAttrPair(resourceName, "logging_config.s3_config.bucket_name", s3BucketResourceName, names.AttrID),
@@ -67,7 +88,7 @@ func testAccModelInvocationLoggingConfiguration_disappears(t *testing.T) {
6788
CheckDestroy: testAccCheckModelInvocationLoggingConfigurationDestroy(ctx),
6889
Steps: []resource.TestStep{
6990
{
70-
Config: testAccModelInvocationLoggingConfigurationConfig_basic(rName),
91+
Config: testAccModelInvocationLoggingConfigurationConfig_basic(rName, acctest.CtTrue, acctest.CtTrue, acctest.CtTrue, acctest.CtTrue),
7192
Check: resource.ComposeAggregateTestCheckFunc(
7293
testAccCheckModelInvocationLoggingConfigurationExists(ctx, resourceName),
7394
acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfbedrock.ResourceModelInvocationLoggingConfiguration, resourceName),
@@ -118,7 +139,7 @@ func testAccCheckModelInvocationLoggingConfigurationDestroy(ctx context.Context)
118139
}
119140
}
120141

121-
func testAccModelInvocationLoggingConfigurationConfig_basic(rName string) string {
142+
func testAccModelInvocationLoggingConfigurationConfig_basic(rName, embeddingDataDeliveryEnabled, imageDataDeliveryEnabled, textDataDeliveryEnabled, videoDataDeliveryEnabled string) string {
122143
return fmt.Sprintf(`
123144
data "aws_caller_identity" "current" {}
124145
data "aws_region" "current" {}
@@ -222,9 +243,10 @@ resource "aws_bedrock_model_invocation_logging_configuration" "test" {
222243
]
223244
224245
logging_config {
225-
embedding_data_delivery_enabled = true
226-
image_data_delivery_enabled = true
227-
text_data_delivery_enabled = true
246+
embedding_data_delivery_enabled = %[2]s
247+
image_data_delivery_enabled = %[3]s
248+
text_data_delivery_enabled = %[4]s
249+
video_data_delivery_enabled = %[5]s
228250
229251
cloudwatch_config {
230252
log_group_name = aws_cloudwatch_log_group.test.name
@@ -237,5 +259,5 @@ resource "aws_bedrock_model_invocation_logging_configuration" "test" {
237259
}
238260
}
239261
}
240-
`, rName)
262+
`, rName, embeddingDataDeliveryEnabled, imageDataDeliveryEnabled, textDataDeliveryEnabled, videoDataDeliveryEnabled)
241263
}

website/docs/r/bedrock_model_invocation_logging_configuration.html.markdown

+37-15
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ resource "aws_bedrock_model_invocation_logging_configuration" "example" {
7070
embedding_data_delivery_enabled = true
7171
image_data_delivery_enabled = true
7272
text_data_delivery_enabled = true
73+
video_data_delivery_enabled = true
7374
s3_config {
7475
bucket_name = aws_s3_bucket.example.id
7576
key_prefix = "bedrock"
@@ -80,21 +81,42 @@ resource "aws_bedrock_model_invocation_logging_configuration" "example" {
8081

8182
## Argument Reference
8283

83-
This resource supports the following arguments:
84-
85-
* `logging_config` - (Required) The logging configuration values to set.
86-
* `cloudwatch_config` – (Optional) CloudWatch logging configuration.
87-
* `large_data_delivery_s3_config` – (Optional) S3 configuration for delivering a large amount of data.
88-
* `bucket_name` – (Required) S3 bucket name.
89-
* `key_prefix` – (Optional) S3 prefix.
90-
* `log_group_name` – (Required) Log group name.
91-
* `role_arn` – (Optional) The role ARN.
92-
* `embedding_data_delivery_enabled` – (Optional) Set to include embeddings data in the log delivery.
93-
* `image_data_delivery_enabled` – (Optional) Set to include image data in the log delivery.
94-
* `s3_config` – (Optional) S3 configuration for storing log data.
95-
* `bucket_name` – (Required) S3 bucket name.
96-
* `key_prefix` – (Optional) S3 prefix.
97-
* `text_data_delivery_enabled` – (Optional) Set to include text data in the log delivery.
84+
The following arguments are required:
85+
86+
* `logging_config` - (Required) The logging configuration values to set. See [`logging_config` Block](#logging_config-block) for details.
87+
88+
### `logging_config` Block
89+
90+
The `logging_config` configuration block supports the following arguments:
91+
92+
* `cloudwatch_config` – (Optional) CloudWatch logging configuration. See [`cloudwatch_config` Block](#cloudwatch_config-block) for details.
93+
* `embedding_data_delivery_enabled` – (Optional) Set to include embeddings data in the log delivery. Defaults to `true`.
94+
* `image_data_delivery_enabled` – (Optional) Set to include image data in the log delivery. Defaults to `true`.
95+
* `s3_config` – (Optional) S3 configuration for storing log data. See [`s3_config` Block](#s3_config-block) for details.
96+
* `text_data_delivery_enabled` – (Optional) Set to include text data in the log delivery. Defaults to `true`.
97+
* `video_data_delivery_enabled` – (Optional) Set to include text data in the log delivery. Defaults to `true`.
98+
99+
### `cloudwatch_config` Block
100+
101+
The `cloudwatch_config` configuration block supports the following arguments:
102+
103+
* `large_data_delivery_s3_config` – (Optional) S3 configuration for delivering a large amount of data. See [`large_data_delivery_s3_config` Block](#large_data_delivery_s3_config-block) for details.
104+
* `log_group_name` – (Required) Log group name.
105+
* `role_arn` – (Optional) The role ARN.
106+
107+
### `large_data_delivery_s3_config` Block
108+
109+
The `large_data_delivery_s3_config` configuration block supports the following arguments:
110+
111+
* `bucket_name` – (Required) S3 bucket name.
112+
* `key_prefix` – (Optional) S3 prefix.
113+
114+
### `s3_config` Block
115+
116+
The `s3_config` configuration block supports the following arguments:
117+
118+
* `bucket_name` – (Required) S3 bucket name.
119+
* `key_prefix` – (Optional) S3 prefix.
98120

99121
## Attribute Reference
100122

0 commit comments

Comments
 (0)