diff --git a/examples/README.md b/examples/README.md index f87f5c1..851f933 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1 +1,27 @@ -# TODO \ No newline at end of file +## Upload file to S3 + +``` +resource "epilot-file_upload_file" "my_uploadfile" { + filename = "pumpkin.png" + mime_type = "image/png" +} + +``` + +``` +output "val" { + value = epilot-file_upload_file.my_uploadfile +} +``` + +## Save uploaded file + +``` +resource "epilot-file_file" "my_file" { + access_control = "private" + filename = epilot-file_upload_file.my_uploadfile.filename + bucket = epilot-file_upload_file.my_uploadfile.s3ref.bucket + key = epilot-file_upload_file.my_uploadfile.s3ref.key +} +``` + diff --git a/examples/resources/epilot-file_file/resource.tf b/examples/resources/epilot-file_file/resource.tf index e138143..50cd70b 100644 --- a/examples/resources/epilot-file_file/resource.tf +++ b/examples/resources/epilot-file_file/resource.tf @@ -1,6 +1,6 @@ resource "epilot-file_file" "my_file" { - access_control = "private" - filename = "blaaa.png" - bucket = "epilot-prod-user-content" - key = "66/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/nishu.png" + access_control = "private" + filename = epilot-file_upload_file.my_uploadfile.filename + bucket = epilot-file_upload_file.my_uploadfile.s3ref.bucket + key = epilot-file_upload_file.my_uploadfile.s3ref.key } \ No newline at end of file diff --git a/examples/resources/epilot-file_upload_file/provider.tf b/examples/resources/epilot-file_upload_file/provider.tf index 8453978..ea4347f 100644 --- a/examples/resources/epilot-file_upload_file/provider.tf +++ b/examples/resources/epilot-file_upload_file/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { epilot-file = { source = "epilot-dev/epilot-file" - version = "2.0.2" + version = "2.1.1" } } } diff --git a/examples/resources/epilot-file_upload_file/pumpkin.png b/examples/resources/epilot-file_upload_file/pumpkin.png new file mode 100644 index 0000000..256cfae Binary files /dev/null and b/examples/resources/epilot-file_upload_file/pumpkin.png differ diff --git a/examples/resources/epilot-file_upload_file/resource.tf b/examples/resources/epilot-file_upload_file/resource.tf index 922741d..a160345 100644 --- a/examples/resources/epilot-file_upload_file/resource.tf +++ b/examples/resources/epilot-file_upload_file/resource.tf @@ -1,5 +1,20 @@ +# Upload file to S3 resource "epilot-file_upload_file" "my_uploadfile" { - file_entity_id = "ef7d985c-2385-44f4-9c71-ae06a52264f8" - filename = "document.pdf" - mime_type = "application/pdf" -} \ No newline at end of file + filename = "pumpkin.png" + mime_type = "image/png" +} + +output "val" { + value = epilot-file_upload_file.my_uploadfile +} + + +# Save uploaded file +resource "epilot-file_file" "my_file" { + access_control = "private" + filename = epilot-file_upload_file.my_uploadfile.filename + bucket = epilot-file_upload_file.my_uploadfile.s3ref.bucket + key = epilot-file_upload_file.my_uploadfile.s3ref.key +} + +