package
Standard build scripts combining Terraform and custom pre- and post- deploy options
npm install @sofarocean/loftGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
loft is a set of command line utilities that provide a standard way of managing and deploying infrastructure and code across multiple environments using git, Github, and Terraform.
"Lofting is a drafting technique whereby curved lines are generated, to be used in plans for streamlined objects such as aircraft and boats."
loft is published on npm and can be executed anywhere with npx:
npx @sofarocean/loftIf you find yourself using loft frequently from the command line, you can create an alias by adding an entry to your ~/.profile, ~/.bashrc, or similar:
alias loft='npx @sofarocean/loft'And then running commands from any directory such as:
loft deploydeploynpx @sofarocean/loft deploy [--pre-apply <script>] [--post-apply <script>]Running this command from your local machine or on a CI/CD server (such as with Github Actions) will:
dev, staging, or prod) frome the current git branchterraform apply with the .tfvars corresponding to the chosen deploy environmentThe deployment environment can be overridden with the -d or --deploy-env option.
For a full list of options, run:
npx @sofarocean/loft deploy -hWhen running on a CI/CD server, you can set the -a or --auto-approve option to auto-approve the Terraform changes.
promoteUse promote to bring code from one environment up to date with another. This is typically used to promote code on dev->staging or staging->prod.
In most cases, you can just run:
npx @sofarocean/loft promoteThis will infer the target branch based on your current branch (e.g. if you are currently on dev, this will attempt to promote dev->staging).
You can also specify a target branch:
npx @sofarocean/loft promote --target masterBefore promoting, loft will show you a log of the commits that differ between your current and target branches. Run these by your team before promoting to make sure everything looks good to go!
promote will only attempt a fast-forward merge. This will fail if the target branch contains code that is not on the current branch, as is the case when a hotfix was applied directly on the target branch. In this case, you will need to back-merge the changes onto your current branch and resolve any merge conflicts manually before continuing.
Back merging is as simple as:
git merge <target>where <target> was your original target branch.
initInitialize a project with the standard deployment setup:
/terraform directory with [dev,staging,prod].tfvars files[dev,staging,prod].env files for environment variables in each environmentgit init if neededdev and staging git branch and checkout devdev, branch protection, linear history, etc?testdeploy, but set up environment variables before running test commanddestroyterraform destroy that sets variables based on environment and branch, similar to loft deployRegistry package owners.
Estimated unpacked size across 32 packages.
877.2 kB
Includes dependencies.
5 direct · 4 outdated
^3.0.0
6.0.1
^8.2.0
18.0.10
^7.1.0
14.3.0
^5.0.0
15.1.0
^2.2.1
2.2.1