Skip to content

ok

Kjøremiljø provides a tool called ok to help you get started with writing Terraform code and manage different environments.

Installation

Download ok

To install ok, run these commands:

mkdir -p "$HOME/bin"; \
gh release download ok_binaries-latest --repo "oslokommune/golden-path-iac" --pattern "ok" --pattern "port-forward" --dir "$HOME/bin"; \
chmod +x "$HOME/bin/ok" "$HOME/bin/port-forward"

Verify that the ok command is available by running the following command:

ok version

If you get an error that looks like Command not found or similar, see the section Error: Command not found.

Authenticate to GitHub

To make the various commands in ok work, we need to authenticate to GitHub:

gh auth login

Verify that it works by running:

ok get-template

If you don't get an error, you're good to go.

Updating

To update the ok tool, run the following command:

ok update

You will be presented a list of available versions. Select the version you want to use and the tool will be updated.

Error: Command not found

If ok is not found, you might need to add $HOME/bin to your $PATH environment variable. We walked through this as part of the tfswitch installation. If you skipped this part you'll have to add it to your $PATH variable now.

export PATH=$PATH:$HOME/bin

To make it persistent, you can add the following line to your shell configuration file:

echo 'export PATH=$PATH:$HOME/bin' >> ~/.zshrc
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bash_profile

If it still doesn't work, check the content of the $HOME/bin/ok file.

cat $HOME/bin/ok

If the file is empty, something wrong happened when you downloaded the file. Try to download it again.