Retreive multiple AWS S3 objects

Is there a possibility to retreive the contents of a S3 bucket in multiple aws_s3_bucket_object at once? I want to have something like this:

data “aws_s3_bucket_object” “states” {
bucket = “mybucket”
filter {
key =“states/”
}
}

I want to access it like this:

output “states” {
value=data.aws_s3_bucket_object.states.*.key
}

and this shoult deliver all objects in the bucket with a key that starts with “states/”

1 Like