{"id":17528541,"url":"https://github.com/vancluever/infrastructure.sh","last_synced_at":"2025-03-06T08:32:02.989Z","repository":{"id":73276485,"uuid":"78390482","full_name":"vancluever/infrastructure.sh","owner":"vancluever","description":"Bash script for controlling Terraform build workflows thru Git tags","archived":true,"fork":false,"pushed_at":"2017-03-12T17:02:27.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T11:15:02.642Z","etag":null,"topics":["bash","terraform","travis"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/vancluever.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":"2017-01-09T03:29:54.000Z","updated_at":"2024-07-25T01:26:18.000Z","dependencies_parsed_at":"2023-04-06T23:07:28.703Z","dependency_job_id":null,"html_url":"https://github.com/vancluever/infrastructure.sh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Finfrastructure.sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Finfrastructure.sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Finfrastructure.sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Finfrastructure.sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vancluever","download_url":"https://codeload.github.com/vancluever/infrastructure.sh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242176481,"owners_count":20084582,"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":["bash","terraform","travis"],"created_at":"2024-10-20T15:44:02.392Z","updated_at":"2025-03-06T08:32:02.959Z","avatar_url":"https://github.com/vancluever.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# infrastructure.sh\n\nThis is a bash script that helps you control infrastructure-related jobs that\nrun [Terraform][1] in your CI system to deploy your infrastructure.\n\n[1]: https://terraform.io/\n\n## What You Need\n\n * A repository where your Terraform code resides in `terraform/`.\n * Your versioning scheme must be [semantic versioned][2] with the versions\n   being written to tags.\n * You do most, if not all, of your work out of `master` with your remote\n   configured for `origin`.\n * You have the following installed:\n  * `git`\n  * `bash` 4+\n  * And you are on a system that has `cat`.\n\n[2]: http://semver.org/\n\n## The Concept\n\nYour code resides in a repository along with your Terraform code. This code is\nversioned and released using a versioning scheme that matches something like\nwhat would be managed by [`release.sh`][2].\n\n[3]: https://github.com/vancluever/release.sh\n\nThis script will then search the repository for all tags that match the `vX.X.X`\nsemver-style versioning format. The last 10 are presented to you, from which you\ncan choose a version, either the most recent one (the default), or a previous\none (in the event you need to roll back).\n\nThis script writes out a `terraform/version.tf` file that contains the\n`build_version` variable. You can then handle this variable any way in your\nTerraform code that you need to.\n\nAfter writing out this version, the file is committed with a computed tag in the\nmessage. This will be the tag that this commit gets tagged with after. The tag\nfollows the format:\n\n```\ninfrastructure#BUILDNUM-VERSION\n```\n\nThe build number is unique and is attached as a note to this commit as a Git\nnote under the `infrastructure_build_number` reference. This is incremented\nevery time a new run of this script happens.\n\nAs mentioned, after the commit happens, this is the tag that gets written out.\nAfter the commit, tag, and new build number note are written out, everything\ngets pushed.\n\n## What do I do with the Tag?\n\nIn your CI system (ie: Travis), set up your build rules to run your Terraform\noperations off of tags that start with `infrastructure`. Example for Travis can\nbe found in [this project][4].\n\n[4]: https://github.com/vancluever/ubc_icdp\n\nThe tag is designed to be verbose enough that it's easy to pick out in your CI\nsystem.\n\n## Re-running a Failed Terraform Run\n\nIf your Terraform run fails, you have two options:\n\n * For **non-source code or TF config issues**, you can correct the problems\n   that need to be corrected in your CI system or elsewhere (example: correct\n   missing or misconfigured variables, fix AWS credentials, etc), and just\n   re-run the job if that's available to you.\n * For issues with the TF code, correct the changes, commit them, and re-run the\n   script.\n    * The script can be re-run even if you don't need to change any code, but\n      would like the build number incremented. `version.tf` is timestamped, so\n      there will always be something to commit.\n    * Note that this script **only** commits `terraform/version.tf`. If you need\n      to correct other parts of the TF code make sure you commit your changes\n      before re-running the script.\n\n## License\n\n```\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \u003chttp://unlicense.org/\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Finfrastructure.sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvancluever%2Finfrastructure.sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Finfrastructure.sh/lists"}