{"id":17991377,"url":"https://github.com/jareware/terraform-utils","last_synced_at":"2025-09-03T05:36:39.206Z","repository":{"id":41514641,"uuid":"163942516","full_name":"jareware/terraform-utils","owner":"jareware","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-04T03:31:24.000Z","size":430,"stargazers_count":15,"open_issues_count":1,"forks_count":6,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-08-31T19:43:13.096Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jareware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-03T08:10:42.000Z","updated_at":"2025-08-28T18:40:07.000Z","dependencies_parsed_at":"2024-10-29T20:09:41.386Z","dependency_job_id":null,"html_url":"https://github.com/jareware/terraform-utils","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/jareware/terraform-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2Fterraform-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2Fterraform-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2Fterraform-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2Fterraform-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jareware","download_url":"https://codeload.github.com/jareware/terraform-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jareware%2Fterraform-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273397759,"owners_count":25098233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-29T19:21:33.843Z","updated_at":"2025-09-03T05:36:39.155Z","avatar_url":"https://github.com/jareware.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Utils\n\nThis repository contains reusable [Terraform](https://www.terraform.io/) utility modules, which are liberally licensed, and can be shared between projects.\n\n## Design decisions\n\n1. Each module should be thoroughly documented with a README - no source code dumps\n1. Each module should have easy to use examples - for delicious copy-pasta\n1. Modules need not offer infinite flexibility, but do one thing well - users can always make their own module using ours as a baseline\n\n## Naming conventions\n\n### Short version\n\nFor each module in this repository, you can either:\n\n- Provide a `name_prefix` as input, and all resources created by that module will have names starting with that prefix, or\n- Not provide `name_prefix`, and all resource names will have a unique, generated prefix, guaranteed to not conflict with other resource names\n\n### Longer version\n\nWhen creating resources on AWS, it's common to follow a hierarchical naming convention such as the following:\n\n1. All resources related to your app have names starting with `my-app`\n1. Then the environment (e.g. `dev` or `prod`)\n1. Then the component/tier (e.g. `frontend` or `backend`)\n1. Then a possible sub-component (e.g. `api` or `worker` for backend)\n1. Then a possible name for the individual resource (e.g. `logs` or `content`)\n\nIf you model your Terraform module structure in the same fashion, you might end up with something like this:\n\n```\nmy-app\n├── dev\n│   ├── backend\n│   │   ├── api\n│   │   └── worker\n│   │       └── logs\n│   └── frontend\n│       └── content\n└── prod\n    ├── backend\n    │   ├── api\n    │   └── worker\n    │       └── logs\n    └── frontend\n        └── content\n```\n\nAnd thus resource names like:\n\n```\nmy-app-dev-backend\nmy-app-dev-backend-api\nmy-app-dev-backend-worker\nmy-app-dev-backend-worker-logs\nmy-app-dev-frontend\nmy-app-dev-frontend-content\nmy-app-prod-backend\nmy-app-prod-backend-api\nmy-app-prod-backend-worker\nmy-app-prod-backend-worker-logs\nmy-app-prod-frontend\nmy-app-prod-frontend-content\n```\n\nAn elegant way to implement this is to have each module take an input called `name_prefix`, and pass it along to its child modules. That is:\n\n1. In your root module, set `name_prefix` to a default value:\n   ```\n   variable \"name_prefix\" {\n     default = \"my-app\"\n   }\n   ```\n1. When you instantiate your main module for different environments, you pass along `name_prefix` with the appropriate suffix:\n\n   ```\n   module \"dev\" {\n     name_prefix = \"${var.name_prefix}-dev\"\n   }\n\n   module \"prod\" {\n     name_prefix = \"${var.name_prefix}-prod\"\n   }\n   ```\n\n1. Within that module, when you instantiate modules for backend \u0026 frontend, you again pass along `name_prefix`:\n   ```\n   module \"backend\" {\n     name_prefix = \"${var.name_prefix}-backend\"\n   }\n   ```\n1. And so on, for each level of the module hierarchy\n1. On any level, when creating resources, you do so using the same prefix, for example creating an S3 bucket:\n   ```\n   resource \"aws_s3_bucket\" \"content\" {\n     bucket = \"${var.name_prefix}-content\"\n   }\n   ```\n\nThus, each module gets a dedicated namespace that's:\n\n- guaranteed to not conflict with resources from other modules\n- not tied to the top level namespace, facilitating reuse\n- easy to identify on the AWS web console as belonging to a specific env/component/etc\n- convenient for use with IAM permissions (e.g. granting dev env backend access to `my-app-dev-backend-*`, thus excluding the frontend component, and the production environment entirely)\n\n**All modules within this repository follow this convention**, taking a `name_prefix`, and passing it along to their child modules (if any).\n\nIf you don't want to follow this convention, you can simply omit the `name_prefix` input. In that case, a unique name prefix is generated automatically (`\"aws-static-site-2rdc7iqm\"` for the `aws_static_site` module, for example), thus ensuring your resource names won't clash with those of others.\n\n## Caveats\n\n- At the time of writing, [support for the `profile` property of the AWS provider is still... wonky](https://github.com/terraform-providers/terraform-provider-aws/issues/233), especially in cases where the provider needs to be aliased. Configuring your AWS provider via the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables is recommended wholeheartedly.\n\n## Versioning policy\n\n1. New versions are released often, so users can pin their modules (using `master` as a `source` for Terraform modules is a terrible idea)\n1. Bump major version when either new modules are released, or existing modules get backwards-incompatible changes\n1. Bump minor version otherwise\n\n## Additional resources\n\nIn addition to the modules here, there's a lot of useful ones in the wild. For example:\n\n- https://registry.terraform.io/ - lots of solutions to common problems, some verified by Hashicorp themselves\n- https://github.com/cloudposse - look for repos starting with `terraform-` for lots of good building blocks\n\n## Release process\n\nPlease use the included release script. For example:\n\n```\n$ ./release.sh\nChecking dependencies... OK\nRunning terraform fmt... OK\nChecking for clean working copy... OK\nParsing git remote... OK\nVerifying GitHub API access... OK\nFetching previous tags from GitHub... OK\n\nPrevious release was: v9.1\nThis release will be: v9.2\n\nTagging new release... OK\nPushing release to GitHub... OK\nCreating release on GitHub... OK\nUpdating example code with new release... OK\nUpdating Terraform module docs... OK\nCreating commit from docs updates... OK\nPushing updated docs to GitHub... OK\nCleaning up... OK\n\nNew release is: https://github.com/futurice/terraform-utils/releases/tag/v9.2\n\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareware%2Fterraform-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjareware%2Fterraform-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjareware%2Fterraform-utils/lists"}