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: adding terramate-block #62

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions cli/projects/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ will occur.

Project-wide configuration can be defined in this block. All possible settings are described in the following subsections.

<a id="the-terramateconfiggit-block"></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding those @AnnuCode ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the heading includes an inline code, I had to add an anchor tag to link to that heading in another markdown file. Without this, the generated heading removed hyphens and couldn't link to the correct section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not correct ... e.g. the following link works and jumps directly to the right headline: https://terramate.io/docs/cli/reference/variables/metadata#stack-metadata

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.

[foo](./terramate.md#the-terramate-block)

should work.. the <a> element shouldn't be required at all. we don't use it anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, I've corrected the section links. Thanks!

### The `terramate.config.git` block

[Git integration](../change-detection/integrations/git.md) related configurations used in the
Expand All @@ -92,6 +93,7 @@ terramate {
}
```

<a id="the-terramateconfiggenerate-block"></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here? we don't need this?

### The `terramate.config.generate` block

The `terramate.config.generate` block can be used to configure the code generate feature.
Expand All @@ -112,6 +114,7 @@ terramate {
The config above will make Terramate generate files using `#` as comment style.
The only valid options are `//` and `#`.

<a id="the-terramateconfigrun-block"></a>
### The `terramate.config.run` Block

Configuration for the `terramate run` command can be set in the `terramate.config.run` block.
Expand Down Expand Up @@ -200,6 +203,7 @@ on `terramate.config.run.env` blocks won't affect the `env` namespace.
You can have multiple `terramate.config.run.env` blocks defined on different
files, but variable names **cannot** be defined twice.

<a id="the-terramateconfigcloud-block"></a>
### The `terramate.config.cloud` block

Properties related to Terramate Cloud can be defined inside the `terramate.config.cloud` block.
Expand Down
43 changes: 43 additions & 0 deletions cli/reference/blocks/terramate.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,46 @@ description: Learn how to configure a Terramate project using the terramate bloc
---

# The `terramate` block

Use the `terramate` block to define project-wide configurations in the project's root. The `terramate` block is defined in the `terramate.tm.hcl` file and overrides any defaults by Terramate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For correctness, the terramate block can be defined in any file in the root directory. Usually, we place it in the terramate.tm.hcl but it can have any name.


## Arguments

- `required_version`: specify the Terramate version to be used inside a project. More details about this attribute are [here](../../projects/configuration.md#the-terramaterequired_version-attribute).
- `config`: define project-wide configurations in this block.
- `config.git`: [configure](../../projects/configuration.md#the-terramateconfiggit-block) git integration
- `config.generate`: [configure](../../projects/configuration.md#the-terramateconfiggenerate-block) code generation feature
- `config.run`: [configure](../../projects/configuration.md#the-terramateconfiggenerate-block) the `terramate run` command or set environment variables for it
- `config.cloud`: [configure](../../projects/configuration.md#the-terramateconfigcloud-block) the default Terramate Cloud organization name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cloud is the block, the organization attribute is used to configure the Terramate Cloud Organization used in this project


## Syntax

```hcl
terramate {
required_version = "terramate-version"
config {
git {
# Git configuration
default_remote = "origin"
default_branch = "main"

# Safeguard
check_untracked = false # Deprecated as of v0.4.5 (use terramate.config.disable_safeguards instead)
check_uncommitted = false # Deprecated as of v0.4.5 (use terramate.config.disable_safeguards instead)
check_remote = false # Deprecated as of v0.4.5 (use terramate.config.disable_safeguards instead)
}
generate {
hcl_magic_header_comment_style = "# or //"
}
run {
check_gen_code = false # Deprecated as of v0.4.5 (use terramate.config.disable_safeguards instead)
env {
TF_PLUGIN_CACHE_DIR = "/some/path/etc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation seems off here

}
}
cloud {
organization = "cloud-org-name"
}
}
}
```