Reference existing S3 bucket in aws_s3_bucket_notification

I have an existing lambda. The new terraform script is creating a lambda and adding S trigger.
Getting error “Can’t access attributes on a primitive-typed value (string)”

data “aws_s3_bucket” “selected” {
bucket = var.my_bucket_name
}

Adding S3 bucket as trigger

resource “aws_s3_bucket_notification” “aws-lambda-trigger” {
bucket = data.aws_s3_bucket.selected.bucket.id
lambda_function {
lambda_function_arn = aws_lambda_function.lambda_function.arn
events = [“s3:ObjectCreated:*”]
}
}

Your data resource is aws "aws_s3_bucket" "selected" and you need to retrieve the ID.
Just replace:
bucket = data.aws_s3_bucket.selected.bucket.id
with:
bucket = data.aws_s3_bucket.selected.id