Data Source: aws_s3_objects

The objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket.

Example Usage

The following example retrieves a list of all object keys in an S3 bucket and creates corresponding Terraform object data sources:

data "aws_s3_objects" "my_objects" {
  bucket = "ourcorp"
}

data "aws_s3_object" "object_info" {
  count  = length(data.aws_s3_objects.my_objects.keys)
  key    = element(data.aws_s3_objects.my_objects.keys, count.index)
  bucket = data.aws_s3_objects.my_objects.id
}

Argument Reference

This data source supports the following arguments:

Attribute Reference

This data source exports the following attributes in addition to the arguments above: