I would like to safely load data from an s3_bucket_object. Meaning if s3 object doesn't exist provide a default value instead. Is there a way to do that ?
If I specify the non existing key, I get a failure
data "aws_s3_bucket_object" "deployed_builds_s3" {
bucket = my_bucket_name
key = "path/to/file.txt"
}
error:
Error: Failed getting S3 object: NotFound: Not Found
I know it's possible to do with local files like this for example:
locals {
file_content = fileexists("file.txt") ? file("file.txt") : ""
}
Is there something similar with s3 objects ?