Skip to content

Commit 5265262

Browse files
authored
Merge pull request #45469 from sabithamuppuri/fix_aws_bedrock_model_invocation_logging_configuration_cloudwatch_role_arn
doc: mark Bedrock CloudWatch role_arn as required instead of optional
2 parents d50485f + 529e8e9 commit 5265262

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.changelog/45469.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/aws_bedrock_model_invocation_logging_configuration: Mark `logging_config.s3_config.bucket_name`, `logging_config.cloudwatch_config.log_group_name`, `logging_config.cloudwatch_config.role_arn`, and `logging_config.cloudwatch_config.large_data_delivery_s3_config.bucket_name` as Required
3+
```

internal/service/bedrock/model_invocation_logging_configuration.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ func (r *modelInvocationLoggingConfigurationResource) Schema(ctx context.Context
8282
NestedObject: schema.NestedBlockObject{
8383
Attributes: map[string]schema.Attribute{
8484
names.AttrLogGroupName: schema.StringAttribute{
85-
// Must set to optional to avoid validation error
86-
// See: https://github.com/hashicorp/terraform-plugin-framework/issues/740
87-
Optional: true,
85+
Required: true,
8886
},
8987
names.AttrRoleARN: schema.StringAttribute{
9088
CustomType: fwtypes.ARNType,
91-
Optional: true,
89+
Required: true,
9290
},
9391
},
9492
Blocks: map[string]schema.Block{
@@ -100,7 +98,7 @@ func (r *modelInvocationLoggingConfigurationResource) Schema(ctx context.Context
10098
NestedObject: schema.NestedBlockObject{
10199
Attributes: map[string]schema.Attribute{
102100
names.AttrBucketName: schema.StringAttribute{
103-
Optional: true,
101+
Required: true,
104102
},
105103
"key_prefix": schema.StringAttribute{
106104
Optional: true,
@@ -119,7 +117,7 @@ func (r *modelInvocationLoggingConfigurationResource) Schema(ctx context.Context
119117
NestedObject: schema.NestedBlockObject{
120118
Attributes: map[string]schema.Attribute{
121119
names.AttrBucketName: schema.StringAttribute{
122-
Optional: true,
120+
Required: true,
123121
},
124122
"key_prefix": schema.StringAttribute{
125123
Optional: true,

internal/service/bedrock/model_invocation_logging_configuration_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ resource "aws_s3_bucket" "test" {
219219
}
220220
}
221221
222+
# Use "data.aws_region.current.name" instead of "data.aws_region.current.region" as this configguration
223+
# is used in a v6.0.0 upgrade test and must work in pre-v6.0.0 scenarios.
224+
222225
resource "aws_s3_bucket_policy" "test" {
223226
bucket = aws_s3_bucket.test.bucket
224227
@@ -241,7 +244,7 @@ resource "aws_s3_bucket_policy" "test" {
241244
"aws:SourceAccount": "${data.aws_caller_identity.current.account_id}"
242245
},
243246
"ArnLike": {
244-
"aws:SourceArn": "arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:*"
247+
"aws:SourceArn": "arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"
245248
}
246249
}
247250
}]
@@ -270,7 +273,7 @@ resource "aws_iam_role" "test" {
270273
"aws:SourceAccount": "${data.aws_caller_identity.current.account_id}"
271274
},
272275
"ArnLike": {
273-
"aws:SourceArn": "arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:*"
276+
"aws:SourceArn": "arn:${data.aws_partition.current.partition}:bedrock:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"
274277
}
275278
}
276279
}]

website/docs/r/bedrock_model_invocation_logging_configuration.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The `cloudwatch_config` configuration block supports the following arguments:
103103

104104
* `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.
105105
* `log_group_name` - (Required) Log group name.
106-
* `role_arn` - (Optional) The role ARN.
106+
* `role_arn` - (Required) The role ARN.
107107

108108
### `large_data_delivery_s3_config` Block
109109

0 commit comments

Comments
 (0)