{"id":21429600,"url":"https://github.com/dc-tec/terraform-aws-s3","last_synced_at":"2026-02-14T14:05:35.424Z","repository":{"id":218418727,"uuid":"746356424","full_name":"dc-tec/terraform-aws-s3","owner":"dc-tec","description":"Terraform AWS S3 Module","archived":false,"fork":false,"pushed_at":"2024-01-23T12:21:15.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-03T15:50:59.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dc-tec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"docs/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-21T20:10:28.000Z","updated_at":"2024-01-21T20:26:40.000Z","dependencies_parsed_at":"2024-11-22T22:18:33.182Z","dependency_job_id":"d1dd6006-f135-473a-9a32-1da136651b9a","html_url":"https://github.com/dc-tec/terraform-aws-s3","commit_stats":null,"previous_names":["dc-tec/terraform-aws-s3"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dc-tec/terraform-aws-s3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dc-tec%2Fterraform-aws-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dc-tec%2Fterraform-aws-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dc-tec%2Fterraform-aws-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dc-tec%2Fterraform-aws-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dc-tec","download_url":"https://codeload.github.com/dc-tec/terraform-aws-s3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dc-tec%2Fterraform-aws-s3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29446374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T12:43:28.304Z","status":"ssl_error","status_checked_at":"2026-02-14T12:43:14.160Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T22:18:24.962Z","updated_at":"2026-02-14T14:05:35.409Z","avatar_url":"https://github.com/dc-tec.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform AWS S3 Bucket Module\n\nThis module manages S3 buckets on AWS. It creates S3 buckets, sets their policies, and configures versioning.\n\n## Requirements\n\n- Terraform version 1.7.0 or newer\n- AWS provider version 5.0 or newer\n\n## Providers\n\n- AWS\n\n## Resources\n\n- `aws_s3_bucket.main`: This resource creates an S3 bucket. The bucket name is a combination of a prefix \"s3-\", the bucket name from the `s3_config` variable, and the current AWS region name.\n- `aws_s3_bucket_policy.main`: This resource sets the policy for each S3 bucket created by `aws_s3_bucket.main`. The policy is taken from the `s3_config` variable.\n- `aws_s3_bucket_versioning.main`: This resource configures versioning for each S3 bucket created by `aws_s3_bucket.main`. The versioning status is taken from the `s3_config` variable.\n\n## Inputs\n\n- `s3_config`: A map where each item represents an S3 bucket. Each item should have the following keys:\n  - `bucket`: The name of the bucket.\n  - `policy`: The policy to apply to the bucket.\n  - `versioning`: The versioning status for the bucket.\n- `tags`: A map of tags to apply to all resources.\n\n## Outputs\n\n- `s3_bucket_ids`: The id's from the created S3 buckets\n- `s3_bucket_arns`: The arn's of the created S3 buckets.\n\n## Example Usage\nThe module can be used in the following way. Please note that `policy` is a required argument. For flexibility please include a [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document)\n\n```hcl\nterraform {\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \"~\u003e 5.0\"\n    }\n  }\n  required_version = \"\u003e= 1.7.0\"\n}\n\nprovider \"aws\" {\n  region = var.region\n}\n\ndata \"aws_region\" \"current\" {}\n\ndata \"aws_iam_user\" \"main\" {\n  user_name = local.iam_user_name\n}\n\ndata \"aws_iam_policy_document\" \"main\" {\n  for_each = local.s3_config_yaml\n\n  statement {\n    sid    = \"ListObjectsInBucket\"\n    effect = \"Allow\"\n\n    principals {\n      type        = \"AWS\"\n      identifiers = [\"${data.aws_iam_user.main.arn}\"]\n    }\n\n    actions   = [\"s3:ListBucket\"]\n    resources = [\"arn:aws:s3:::s3-${each.value.bucket}-${data.aws_region.current.name}\"]\n  }\n\n  statement {\n    sid    = \"ReadWriteObjectsInBucket\"\n    effect = \"Allow\"\n\n    principals {\n      type        = \"AWS\"\n      identifiers = [\"${data.aws_iam_user.main.arn}\"]\n    }\n\n    actions   = [\"s3:GetObject\", \"s3:PutObject\", \"s3:DeleteObject\"]\n    resources = [\"arn:aws:s3:::s3-${each.value.bucket}-${data.aws_region.current.name}/*\"]\n  }\n}\n\nlocals {\n  iam_user_name  = \"iam_username\"\n\n  s3_config = {\n    for key, value in var.s3_config :\n    key =\u003e {\n      bucket           = value.bucket\n      acl              = value.acl\n      versioning       = value.versioning\n      object_ownership = value.object_ownership\n      policy           = data.aws_iam_policy_document.main[key].json\n    }\n  }\n}\n\nmodule \"s3\" {\n  source = \"src\"\n\n  ## S3 configuration\n  s3_config = local.s3_config\n}\n\n```\n\nthe following example TFVars can be used with this module.\n\n```hcl\ns3_config = {\n  s3_bucket = {\n    bucket = \"s3-bucket\"\n    acl = \"private\"\n    versioning = \"Enabled\"\n    object_ownership = \"BucketOwnerPreferred\"\n  }\n}\n```\n\n## Notes\n\n- The bucket name will be unique across AWS, as it includes the region name.\n- The bucket policy and versioning status can be customized for each bucket.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdc-tec%2Fterraform-aws-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdc-tec%2Fterraform-aws-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdc-tec%2Fterraform-aws-s3/lists"}