AWS Amazon S3 Upload Buffer
This page shows how to write Terraform for Amazon S3 Upload Buffer and write them securely.
aws_storagegateway_upload_buffer (Terraform)
The Upload Buffer in Amazon S3 can be configured in Terraform with the resource name aws_storagegateway_upload_buffer
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_storagegateway_upload_buffer" "storagegateway_upload_buffer" {
count = var.enable_storagegateway_upload_buffer ? 1 : 0
gateway_arn = var.storagegateway_upload_buffer_gateway_arn != "" ? var.storagegateway_upload_buffer_gateway_arn : (var.enable_storagegateway_gateway ? aws_storagegateway_gateway.storagegateway_gateway[count.index].arn : null)
disk_id = var.storagegateway_upload_buffer_disk_id
resource "aws_storagegateway_upload_buffer" "this" {
disk_id = var.disk_id
gateway_arn = var.gateway_arn
}
resource "aws_storagegateway_upload_buffer" "storagegateway_upload_buffer" {
count = var.enable_storagegateway_upload_buffer ? 1 : 0
gateway_arn = var.storagegateway_upload_buffer_gateway_arn != "" ? var.storagegateway_upload_buffer_gateway_arn : (var.enable_storagegateway_gateway ? aws_storagegateway_gateway.storagegateway_gateway[count.index].arn : null)
disk_id = var.storagegateway_upload_buffer_disk_id
resource "aws_storagegateway_upload_buffer" "buffer" {
count = var.gateway_type == "FILE_S3" ? 0 : 1
disk_path = data.aws_storagegateway_local_disk.storage_gateway_buffer.disk_path
gateway_arn = aws_storagegateway_gateway.storage_gateway.arn
}
Parameters
-
disk_id
optional computed - string -
disk_path
optional computed - string -
gateway_arn
required - string -
id
optional computed - string
Explanation in Terraform Registry
Manages an AWS Storage Gateway upload buffer.
NOTE: The Storage Gateway API provides no method to remove an upload buffer disk. Destroying this Terraform resource does not perform any Storage Gateway actions.
Tips: Best Practices for The Other AWS Amazon S3 Resources
In addition to the aws_s3_bucket_public_access_block, AWS Amazon S3 has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_s3_bucket_public_access_block
Ensure S3 bucket-level Public Access Block restricts public bucket policies
It is better to enable S3 bucket-level Public Access Block if you don't need public buckets.
aws_s3_bucket
Ensure S3 bucket access policy is well configured
It is better to configure the S3 bucket access policy properly to limit it unless explicitly required.
CloudFormation Example
CloudFormation code does not have the related resource.
Frequently asked questions
What is AWS Amazon S3 Upload Buffer?
AWS Amazon S3 Upload Buffer is a resource for Amazon S3 of Amazon Web Service. Settings can be wrote in Terraform.
Where can I find the example code for the AWS Amazon S3 Upload Buffer?
For Terraform, the asrkata/SebastianUA-terraform, niveklabs/aws and SebastianUA/terraform source code examples are useful. See the Terraform Example section for further details.