@@ -146,7 +146,7 @@ func (r *namespaceExportSinkResource) Schema(ctx context.Context, req resource.S
146146 },
147147 "kms_arn" : schema.StringAttribute {
148148 Description : "The AWS Key Management Service (KMS) ARN used for encryption." ,
149- Required : true ,
149+ Optional : true ,
150150 },
151151 "aws_account_id" : schema.StringAttribute {
152152 Description : "The AWS account ID associated with the S3 bucket and the assumed role." ,
@@ -274,9 +274,13 @@ func updateSinkModelFromSpec(ctx context.Context, state *namespaceExportSinkReso
274274 RoleName : types .StringValue (sink .GetSpec ().GetS3 ().GetRoleName ()),
275275 BucketName : types .StringValue (sink .GetSpec ().GetS3 ().GetBucketName ()),
276276 Region : types .StringValue (sink .GetSpec ().GetS3 ().GetRegion ()),
277- KmsArn : types .StringValue (sink .GetSpec ().GetS3 ().GetKmsArn ()),
278277 AwsAccountId : types .StringValue (sink .GetSpec ().GetS3 ().GetAwsAccountId ()),
279278 }
279+
280+ if sink .GetSpec ().GetS3 ().GetKmsArn () != "" {
281+ s3Spec .KmsArn = types .StringValue (sink .GetSpec ().GetS3 ().GetKmsArn ())
282+ }
283+
280284 s3Obj , diags = types .ObjectValueFrom (ctx , internaltypes .S3SpecModelAttrTypes , s3Spec )
281285 diags .Append (diags ... )
282286 if diags .HasError () {
@@ -411,16 +415,22 @@ func getSinkSpecFromModel(ctx context.Context, plan *namespaceExportSinkResource
411415 return nil , diags
412416 }
413417
418+ s3SinkSpec := & sinkv1.S3Spec {
419+ RoleName : s3Spec .RoleName .ValueString (),
420+ BucketName : s3Spec .BucketName .ValueString (),
421+ Region : s3Spec .Region .ValueString (),
422+ KmsArn : s3Spec .KmsArn .ValueString (),
423+ AwsAccountId : s3Spec .AwsAccountId .ValueString (),
424+ }
425+
426+ if ! s3Spec .KmsArn .IsNull () {
427+ s3SinkSpec .KmsArn = s3Spec .KmsArn .ValueString ()
428+ }
429+
414430 return & namespacev1.ExportSinkSpec {
415431 Name : plan .SinkName .ValueString (),
416432 Enabled : plan .Enabled .ValueBool (),
417- S3 : & sinkv1.S3Spec {
418- RoleName : s3Spec .RoleName .ValueString (),
419- BucketName : s3Spec .BucketName .ValueString (),
420- Region : s3Spec .Region .ValueString (),
421- KmsArn : s3Spec .KmsArn .ValueString (),
422- AwsAccountId : s3Spec .AwsAccountId .ValueString (),
423- },
433+ S3 : s3SinkSpec ,
424434 }, nil
425435 } else if ! plan .Gcs .IsNull () {
426436 var gcsSpec internaltypes.GCSSpecModel
0 commit comments