Creates an S3 bucket and an object, then sets up an Opensearch package using the object from the S3 bucket.

Terraform Template

resource "aws_opensearch_package" "example" {
  package_name = "example-txt"

  package_source {
    s3_bucket_name = aws_s3_bucket.my_opensearch_packages.bucket
    s3_key = aws_s3_object.example.key
  }
  package_type = "TXT-DICTIONARY"
}

resource "aws_s3_bucket" "my_opensearch_packages" {
  bucket = "my-opensearch-packages"
}

resource "aws_s3_object" "example" {
  bucket = aws_s3_bucket.my_opensearch_packages.bucket
  etag = filemd5("./example.txt")
  key = "example.txt"
  source = "./example.txt"
}