Creates a s3 bucket with policies to allow using it, for attaching to other roles/users
module "s3-generic" {
source = "../..//"
s3_buckets = {
backups = {
bucket = "my-backups"
permissions_boundary = "arn:aws:iam::${get_aws_account_id()}:policy/MyBoundary"
region = "ap-southeast-1"
acl = "private"
log_bucket_for_s3 = "my-access-logs"
policies = [jsonencode(
{
"Version" : "2012-10-17",
"Statement" : [
{
Action : "s3:GetBucketAcl",
Effect : "Allow",
Resource : "arn:aws:s3:::my-backups",
Principal : { "Service" : "logs.ap-southeast-1.amazonaws.com" }
},
{
Action : "s3:PutObject",
Effect : "Allow",
Resource : "arn:aws:s3:::my-backups/**",
Condition : { "StringEquals" : { "s3:x-amz-acl" : "bucket-owner-full-control" } },
Principal : { "Service" : "logs.ap-southeast-1.amazonaws.com" }
}
]
}
)]
server_side_encryption_configuration = {
rule = {
bucket_key_enabled = true
apply_server_side_encryption_by_default = {
sse_algorithm = "aws:kms"
}
}
}
}
}
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
force_destroy | When destroying this user, destroy even if it has non-Terraform-managed IAM access keys, login profile or MFA devices. Without force_destroy a user with non-Terraform-managed access keys and login profile will fail to be destroyed. | bool |
false |
no |
path | Desired path for the IAM user | string |
"/" |
no |
s3_buckets | A map of bucket names to an object describing the S3 bucket settings for the bucket. | map(object({ |
no | |
tags | (Optional) A mapping of tags to assign to the bucket. | map(string) |
{} |
no |
Name | Description |
---|---|
role | The role which has access to the bucket |
s3_buckets | The names of the bucket. |