Skip to content

Commit

Permalink
docs: add terraform recipe to the cookbook (#3305)
Browse files Browse the repository at this point in the history
* docs: add terraform recipe to the cookbook

Signed-off-by: Ali Sajid Imami <[email protected]>

* [autofix.ci] apply automated fixes

* Update docs/mise-cookbook.md

---------

Signed-off-by: Ali Sajid Imami <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: jdx <[email protected]>
  • Loading branch information
3 people authored Nov 30, 2024
1 parent 1cfc822 commit 80579af
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default defineConfig({
{ text: "FAQs", link: "/faq" },
{ text: "Troubleshooting", link: "/troubleshooting" },
{ text: "Tips & Tricks", link: "/tips-and-tricks" },
{ text: "Cookbook", link: "/mise-cookbook" },
{
text: "About",
items: [
Expand Down
47 changes: 47 additions & 0 deletions docs/mise-cookbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Tasks Cookbook

Here we are sharing a few configurations for tasks that other people have found useful.

## Managing `terraform`/`opentofu` Projects

It is often necessary to have your terraform configuration in a `terraform/` subdirectory.
This necessitates the use of syntax like `terraform -chdir=terraform plan` to use appropriate
terraform command. The following config allows you to invoke all of them from `mise`, leveraging
`mise` tasks.

```toml
[tools]
terraform = "1"

[tasks."terraform:init"]
description = "Initializes a Terraform working directory"
run = "terraform -chdir=terraform init"

[tasks."terraform:plan"]
description = "Generates an execution plan for Terraform"
run = "terraform -chdir=terraform plan"

[tasks."terraform:apply"]
description = "Applies the changes required to reach the desired state of the configuration"
run = "terraform -chdir=terraform apply"

[tasks."terraform:destroy"]
description = "Destroy Terraform-managed infrastructure"
run = "terraform -chdir=terraform destroy"

[tasks."terraform:validate"]
description = "Validates the Terraform files"
run = "terraform -chdir=terraform validate"

[tasks."terraform:format"]
description = "Formats the Terraform files"
run = "terraform -chdir=terraform fmt"

[tasks."terraform:check"]
description = "Checks the Terraform files"
depends = ["terraform:format", "terraform:validate"]

[env]
_.file = ".env"

```
20 changes: 10 additions & 10 deletions docs/tips-and-tricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ console.log(`Running node: ${process.version}`);
This can also be useful in environments where mise isn't activated
(such as a non-interactive session).

You can also download the https://mise.run script to use in a project bootstrap script:
You can also download the <https://mise.run> script to use in a project bootstrap script:

```sh
curl https://mise.run > setup-mise.sh
Expand Down Expand Up @@ -156,10 +156,10 @@ Get information about what backend a tool is using and other information with `m
```sh
❯ mise tool ripgrep
Backend: aqua:BurntSushi/ripgrep
Installed Versions: 14.1.1
Active Version: 14.1.1
Requested Version: latest
Config Source: ~/src/mise/mise.toml
Installed Versions: 14.1.1
Active Version: 14.1.1
Requested Version: latest
Config Source: ~/src/mise/mise.toml
Tool Options: [none]
```

Expand All @@ -169,11 +169,11 @@ List the config files mise is reading in a particular directory with `mise cfg`:

```sh
❯ mise cfg
Path Tools
~/.config/mise/config.toml (none)
~/.mise/config.toml (none)
~/src/mise.toml (none)
~/src/mise/.config/mise/conf.d/foo.toml (none)
Path Tools
~/.config/mise/config.toml (none)
~/.mise/config.toml (none)
~/src/mise.toml (none)
~/src/mise/.config/mise/conf.d/foo.toml (none)
~/src/mise/mise.toml actionlint, bun, cargo-binstall, cargo:…
~/src/mise/mise.local.toml (none)
```
Expand Down

0 comments on commit 80579af

Please sign in to comment.