{"id":28646773,"url":"https://github.com/harisekhon/terraform","last_synced_at":"2025-06-13T02:06:53.043Z","repository":{"id":37754636,"uuid":"330749237","full_name":"HariSekhon/Terraform","owner":"HariSekhon","description":"Terraform HCL code for AWS / GCP / Azure / GitHub management","archived":false,"fork":false,"pushed_at":"2024-09-17T12:09:59.000Z","size":359,"stargazers_count":42,"open_issues_count":0,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-17T14:53:45.000Z","etag":null,"topics":["aws","cloudflare","devops","gcp","github","hacktoberfest","hcl","terraform"],"latest_commit_sha":null,"homepage":"https://www.linkedin.com/in/HariSekhon","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/HariSekhon.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":".github/CODEOWNERS","security":"security_groups.tf","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-18T18:09:50.000Z","updated_at":"2024-09-17T12:10:02.000Z","dependencies_parsed_at":"2024-09-17T14:20:44.818Z","dependency_job_id":"f470bbef-8b71-40d3-af13-9317da7cf054","html_url":"https://github.com/HariSekhon/Terraform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HariSekhon/Terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HariSekhon%2FTerraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HariSekhon%2FTerraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HariSekhon%2FTerraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HariSekhon%2FTerraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HariSekhon","download_url":"https://codeload.github.com/HariSekhon/Terraform/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HariSekhon%2FTerraform/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259565561,"owners_count":22877347,"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","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":["aws","cloudflare","devops","gcp","github","hacktoberfest","hcl","terraform"],"created_at":"2025-06-13T02:06:52.227Z","updated_at":"2025-06-13T02:06:53.014Z","avatar_url":"https://github.com/HariSekhon.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Templates\n\n[![GitHub stars](https://img.shields.io/github/stars/HariSekhon/Terraform?logo=github)](https://github.com/HariSekhon/Terraform//stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/HariSekhon/Terraform?logo=github)](https://github.com/HariSekhon/Terraform/network)\n[![LineCount](https://sloc.xyz/github/HariSekhon/Terraform/?badge-bg-color=2081C2)](https://github.com/boyter/scc/)\n[![Cocomo](https://sloc.xyz/github/HariSekhon/Terraform/?badge-bg-color=2081C2\u0026category=cocomo)](https://github.com/boyter/scc/)\n[![License](https://img.shields.io/github/license/HariSekhon/Terraform)](https://github.com/HariSekhon/Terraform/blob/master/LICENSE)\n[![My LinkedIn](https://img.shields.io/badge/LinkedIn%20Profile-HariSekhon-blue?logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIGZpbGw9IiNmZmZmZmYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+TGlua2VkSW48L3RpdGxlPjxwYXRoIGQ9Ik0yMC40NDcgMjAuNDUyaC0zLjU1NHYtNS41NjljMC0xLjMyOC0uMDI3LTMuMDM3LTEuODUyLTMuMDM3LTEuODUzIDAtMi4xMzYgMS40NDUtMi4xMzYgMi45Mzl2NS42NjdIOS4zNTFWOWgzLjQxNHYxLjU2MWguMDQ2Yy40NzctLjkgMS42MzctMS44NSAzLjM3LTEuODUgMy42MDEgMCA0LjI2NyAyLjM3IDQuMjY3IDUuNDU1djYuMjg2ek01LjMzNyA3LjQzM2MtMS4xNDQgMC0yLjA2My0uOTI2LTIuMDYzLTIuMDY1IDAtMS4xMzguOTItMi4wNjMgMi4wNjMtMi4wNjMgMS4xNCAwIDIuMDY0LjkyNSAyLjA2NCAyLjA2MyAwIDEuMTM5LS45MjUgMi4wNjUtMi4wNjQgMi4wNjV6bTEuNzgyIDEzLjAxOUgzLjU1NVY5aDMuNTY0djExLjQ1MnpNMjIuMjI1IDBIMS43NzFDLjc5MiAwIDAgLjc3NCAwIDEuNzI5djIwLjU0MkMwIDIzLjIyNy43OTIgMjQgMS43NzEgMjRoMjAuNDUxQzIzLjIgMjQgMjQgMjMuMjI3IDI0IDIyLjI3MVYxLjcyOUMyNCAuNzc0IDIzLjIgMCAyMi4yMjIgMGguMDAzeiIvPjwvc3ZnPgo=)](https://www.linkedin.com/in/HariSekhon/)\n[![GitHub Last Commit](https://img.shields.io/github/last-commit/HariSekhon/Terraform?logo=github)](https://github.com/HariSekhon/Terraform/commits/master)\n\n[![CI Builds Overview](https://img.shields.io/badge/CI%20Builds-Overview%20Page-blue?logo=circleci)](https://harisekhon.github.io/CI-CD/)\n[![Fmt](https://github.com/HariSekhon/Terraform/actions/workflows/terraform-fmt-write.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/terraform-fmt-write.yaml)\n[![YAML](https://github.com/HariSekhon/Terraform/actions/workflows/yaml.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/yaml.yaml)\n[![ShellCheck](https://github.com/HariSekhon/Terraform/actions/workflows/shellcheck.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/shellcheck.yaml)\n[![Markdown](https://github.com/HariSekhon/Terraform/actions/workflows/markdown.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/markdown.yaml)\n[![Validation](https://github.com/HariSekhon/Terraform/actions/workflows/validate.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/validate.yaml)\n[![tfsec](https://github.com/HariSekhon/Terraform/actions/workflows/tfsec.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/tfsec.yaml)\n[![Checkov](https://github.com/HariSekhon/Terraform/actions/workflows/checkov.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/checkov.yaml)\n[![Grype](https://github.com/HariSekhon/Terraform/actions/workflows/grype.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/grype.yaml)\n[![Kics](https://github.com/HariSekhon/Terraform/actions/workflows/kics.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/kics.yaml)\n[![Semgrep](https://github.com/HariSekhon/Terraform/actions/workflows/semgrep.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/semgrep.yaml)\n[![Semgrep Cloud](https://github.com/HariSekhon/Terraform/actions/workflows/semgrep-cloud.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/semgrep-cloud.yaml)\n[![Trivy](https://github.com/HariSekhon/Terraform/actions/workflows/trivy.yaml/badge.svg)](https://github.com/HariSekhon/Terraform/actions/workflows/trivy.yaml)\n\n[![Repo on GitHub](https://img.shields.io/badge/repo-GitHub-2088FF?logo=github)](https://github.com/HariSekhon/Terraform)\n[![Repo on GitLab](https://img.shields.io/badge/repo-GitLab-FCA121?logo=gitlab)](https://gitlab.com/HariSekhon/Terraform)\n[![Repo on Azure DevOps](https://img.shields.io/badge/repo-Azure%20DevOps-0078D7?logo=azure%20devops)](https://dev.azure.com/harisekhon/GitHub/_git/Terraform)\n[![Repo on BitBucket](https://img.shields.io/badge/repo-BitBucket-0052CC?logo=bitbucket)](https://bitbucket.org/HariSekhon/Terraform)\n\n[git.io/tf-templates](https://git.io/tf-templates)\n\nTerraform templates for AWS / GCP / Azure.\n\nForked from the [Templates](https://github.com/HariSekhon/Templates) repo for which this is now a submodule.\n\n## New\n\n`new.pl` can instantiate these templates as new date-timestamped files, autopopulating the date, vim tags, GitHub URL and other headers and drops you in to your `$EDITOR` of choice (eg. `vim`).\n\nYou can give an exact filename like `provider.tf` or `backend.tf` to instantiate that exact template, or any filename ending in `.tfvars` will instantitate some common terraform variables such as `project`, `region`, `vpc_name` etc...  otherwise any filename ending in `tf` will give you a blank terraform template.\n\nExamples:\n\n```bash\nnew provider.tf\n```\n\n```bash\nnew backend.tf\n```\n\n`new.pl` can be found in the [DevOps Perl tools](https://github.com/HariSekhon/DevOps-Perl-tools) repo.\n\n`alias new=new.pl`\n\n(done automatically in the [DevOps Bash tools](https://github.com/HariSekhon/DevOps-Bash-tools) repo `.bash.d/`)\n\n### New Terraform Structure\n\n```bash\nnew terraform\n```\n\nor shorter:\n\n```bash\nnew tf\n```\n\nInstantly creates and opens all standard files for a Terraform deployment in your `$EDITOR` of choice:\n\n- [provider.tf](https://github.com/HariSekhon/Terraform/blob/master/provider.tf)\n- [backend.tf](https://github.com/HariSekhon/Terraform/blob/master/backend.tf)\n- [variables.tf](https://github.com/HariSekhon/Terraform/blob/master/variables.tf)\n- [versions.tf](https://github.com/HariSekhon/Terraform/blob/master/versions.tf)\n- [terraform.tfvars](https://github.com/HariSekhon/Terraform/blob/master/terraform.tfvars)\n- [main.tf](https://github.com/HariSekhon/Terraform/blob/master/main.tf)\n\nall heavily commented to get a new Terraform environment up and running quickly - with links to things like AWS / GCP regions, Terraform backend providers, state locking etc.\n\n## Troubleshooting\n\n### DeleteConflict: Recreating Resources with Dependencies That Do Not Permit Deletion\n\nExample:\n`│Error: error deleting IAM policy arn:aws:iam::***:policy/MYPOLICY: DeleteConflict: Cannot delete a policy attached to entities.`\n\nThe Terraform AWS Provider does not help you when you recreate a resource that another resources depends on, such as recreating an IAM policy due to a rename, while it is still attached to a role, or recreating an AWS Batch compute environment while it's still attached to queues.\n\nUnfortunately the Terraform AWS Provider isn't smart enough to know that for such dependencies with AWS specific API constraints that it should simply detach, and then reattach afterwards.\n\nThe quickest solution / workaround is to find the dependent resources, and `terraform taint` them so that they are destroyed first using the generic implicit Terraform dependency ordering, eg. the role gets deleted first for recreation because its tainted, then the IAM policy is deleted and recreated with the new name, and then the role is recreated and attached to the new policy.\n\nExample:\n\n`terraform taint \u003cfull_path_of_resource_in_terraform_state\u003e`\n\n## Terraform CI/CD\n\nProduction-grade Terraform CI/CD pipelines can be found for Jenkins and GitHub Actions in my adjacent repos:\n\n- [Jenkins](https://github.com/HariSekhon/Jenkins) - runs terraform code with a specific version of Terraform:\n  - `fmt` (info only)\n  - `validate`\n  - `plan` (saves plan so apply is this exact plan, recommended)\n  - prompts for plan approval\n  - runs `apply`\n  - has full locking and milestones for Plan and Apply stages for serialized queuing to avoid terraform state lock failures\n  - skips intermediate queued runs for efficiency\n\n- [GitHub Actions](https://github.com/HariSekhon/GitHub-Actions) - similar to above, plus:\n  - optional environment / approvals (protects admin credentials for things like GitHub which doesn't have read-only repo API tokens)\n  - posts the full `terraform plan` result into the Pull Request that triggered the workflow, along with the status of `fmt` \u0026 `validate`\n  - applies once Pull Request is merged to the default branch or master or main\n\n### Jenkins screenshots\n\nApplied, ignoring informational fmt check:\n\n![](https://github.com/HariSekhon/Diagrams-as-Code/blob/master/screenshots/terraform_applied_but_failed_fmt_check.png)\n\nPlan found no changes so skipped Apply or asking for Approval:\n\n![](https://github.com/HariSekhon/Diagrams-as-Code/blob/master/screenshots/terraform_plan_no_changes.png)\n\nPlan found changes but Approval was not authorized, so Apply did not proceed:\n\n![](https://github.com/HariSekhon/Diagrams-as-Code/blob/master/screenshots/terraform_not_approved.png)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=HariSekhon/Terraform\u0026type=Date)](https://star-history.com/#HariSekhon/Terraform\u0026Date)\n\n[git.io/tf-templates](https://git.io/tf-templates)\n\n## More Core Repos\n\n\u003c!-- OTHER_REPOS_START --\u003e\n\n### Knowledge\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Knowledge-Base\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Knowledge-Base)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Diagrams-as-Code\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Diagrams-as-Code)\n\n\u003c!--\n\nNot support on GitHub Markdown:\n\n\u003ciframe src=\"https://raw.githubusercontent.com/HariSekhon/HariSekhon/main/knowledge.md\" width=\"100%\" height=\"500px\"\u003e\u003c/iframe\u003e\n\nDoes nothing:\n\n\u003cembed src=\"https://raw.githubusercontent.com/HariSekhon/HariSekhon/main/knowledge.md\" width=\"100%\" height=\"500px\" /\u003e\n\n--\u003e\n\n### DevOps Code\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=DevOps-Bash-tools\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/DevOps-Bash-tools)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=DevOps-Python-tools\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/DevOps-Python-tools)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=DevOps-Perl-tools\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/DevOps-Perl-tools)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=DevOps-Golang-tools\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/DevOps-Golang-tools)\n\n\u003c!--\n[![Gist Card](https://github-readme-stats.vercel.app/api/gist?id=f8f551332440f1ca8897ff010e363e03)](https://gist.github.com/HariSekhon/f8f551332440f1ca8897ff010e363e03)\n--\u003e\n\n### Containerization\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Kubernetes-configs\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Kubernetes-configs)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Dockerfiles\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Dockerfiles)\n\n### CI/CD\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=GitHub-Actions\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/GitHub-Actions)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Jenkins\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Jenkins)\n\n### DBA - SQL\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=SQL-scripts\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/SQL-scripts)\n\n### DevOps Reloaded\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Nagios-Plugins\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugins)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=HAProxy-configs\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/HAProxy-configs)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Terraform\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Terraform)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Packer-templates\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Packer-templates)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Nagios-Plugin-Kafka\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Nagios-Plugin-Kafka)\n\n### Templates\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Templates\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Templates)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Template-repo\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Template-repo)\n\n### Misc\n\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Spotify-tools\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Spotify-tools)\n[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=HariSekhon\u0026repo=Spotify-playlists\u0026theme=ambient_gradient\u0026description_lines_count=3)](https://github.com/HariSekhon/Spotify-playlists)\n\nThe rest of my original source repos are\n[here](https://github.com/HariSekhon?tab=repositories\u0026q=\u0026type=source\u0026language=\u0026sort=stargazers).\n\nPre-built Docker images are available on my [DockerHub](https://hub.docker.com/u/harisekhon/).\n\n\u003c!-- 1x1 pixel counter to record hits --\u003e\n![](https://hit.yhype.me/github/profile?user_id=2211051)\n\n\u003c!-- OTHER_REPOS_END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharisekhon%2Fterraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharisekhon%2Fterraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharisekhon%2Fterraform/lists"}