Name | Version |
---|---|
aws | ~> 5.0 |
Name | Version |
---|---|
aws | 5.52.0 |
No modules.
Name | Type |
---|---|
aws_iam_role.s3_bucket | resource |
aws_s3_bucket.s3_bucket | resource |
aws_s3_bucket_acl.s3_bucket | resource |
aws_s3_bucket_cors_configuration.s3_bucket | resource |
aws_s3_bucket_lifecycle_configuration.s3_bucket | resource |
aws_s3_bucket_notification.sqs_bucket_notification | resource |
aws_s3_bucket_ownership_controls.lambda_codebase_ownership_control | resource |
aws_s3_bucket_policy.s3_bucket | resource |
aws_s3_bucket_public_access_block.public_access_block | resource |
aws_s3_bucket_versioning.s3_bucket | resource |
aws_s3_bucket_website_configuration.s3_bucket | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_region | The AWS region to create the infrastructure in | string |
"eu-west-3" |
no |
bucket_acl | The bucket ACL | string |
"private" |
no |
bucket_cors_rules | The bucket cors rules | map |
{} |
no |
bucket_lifecycle_configuration_rules | The bucket lifecycle configuration rules | list |
[] |
no |
bucket_name | The name of the bucket | string |
"hello" |
no |
bucket_ownership_owner_prefered | BucketOwnerPreferred value | bool |
true |
no |
bucket_policy | The bucket policy | map |
{} |
no |
bucket_role | Do you want to attach a role to your bucket? | map(any) |
{} |
no |
bucket_versioning | The bucket versioning | bool |
false |
no |
bucket_website | The bucket website | bool |
false |
no |
bucket_website_cors_rules | default website cors rules | map(any) |
{} |
no |
bucket_website_error_document | default website error document | string |
"error.html" |
no |
bucket_website_index_document | default website index document | string |
"index.html" |
no |
bucket_website_routing_rules | default website routing rules | any |
{} |
no |
create_public_access_block | Do you want to create public_access_block object. Avoid bc break for existing buckets (set it to false for buckets under or equals to 0.9.16) | bool |
true |
no |
default_tags | n/a | map(string) |
{ |
no |
environment_variables | Environment variables for lambda function | map(any) |
{} |
no |
sqs_enabled | Do you want your s3 send event in a SQS message | bool |
false |
no |
sqs_queues_config | The SQS queues configs | map |
{} |
no |
tags | The tags to apply | map(string) |
{} |
no |
Name | Description |
---|---|
arn | The bucket ARN |
bucket_regional_domain_name | The bucket_regional_domain_name |
name | The bucket name |
website_endpoint | The bucket website_endpoint |
Terraform module which provision AWS S3 bucket.
module "my_example_module" {
source = "../" # in this example, this is a local module. For real use, source will be "OpenClassrooms/lambda-apigw-module/aws"
bucket_name = "test_bucket"
bucket_acl = "private"
bucket_versioning = true
bucket_lifecycle_configuration = [{
id = "test_bucket"
status = "Enabled"
transition = [{
days = 60
storage_class = "GLACIER"
}]
expiration = [{
days = 300
}]
}]
bucket_policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "S3FullAccess",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789:root"
},
"Action": "s3:*",
"Resource": ["arn:aws:s3:::test_bucket", "arn:aws:s3:::test_bucket/*"]
}
]
}
POLICY
sqs_enabled = true
sqs_queues_config = [
{
arn = "arn:aws:sqs:*:*:s3-event-notification-queue"
events = ["s3:ObjectCreated:*"]
}
]
tags = var.tags
}
Complete example - Create AWS S3 bucket and all sub resources
Name | Version |
---|---|
terraform | >= 1.1.2 |
aws | >= 4.2 |