Component Definition β
A Component is defined using a define component {} block. One component per directory.
Metadata β
hcl
define component metadata {
class = "example.com/my-component"
version = "1.0.0"
name = "My Component"
description = <<-EOF
My first Terramate Component is doing amazing stuff
EOF
# Optional
technologies = ["aws", "terraform"]
}Inputs β
hcl
define component {
input "name" {
type = string
description = "Set a name for the service"
}
input "visibility" {
type = string
description = "Visibility of the Resource"
default = "private"
}
}Code generation β
All Terramate configuration in the component directory participates in code generation (generate_hcl, generate_file, or .tmgen files).
- Access component inputs as
component.input.<name>.value. - Pass bundle inputs down explicitly via the bundleβs component instantiation
inputsmap.
Example component instantiation inside a bundle stack:
hcl
component "members" {
source = "/components/terramate.io/terramate-tf-github-organization-members/v1"
inputs = { for k in tm_keys(bundle.input) : k => bundle.input[k].value }
}Related guides and references β
- Concepts: Components
- Howβto: Convert a TF module to a Component