Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add terraform recipe to the cookbook #3305

Merged
merged 6 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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