Skip to main content

Tf components definition

Terraform (Tf) components in Dinghy are simply standard React components that extend the Shape component from @dinghy/base-components with additional attributes specifically for Terraform integration. There is nothing inherently special or different about their definition compared to other Dinghy components; they use the same patterns and can leverage all standard features of React and Dinghy's component system.

_category

When rendering Infrastructure as Code (IaC), any component that defines a _category property is used to generate the corresponding tf.json output.

The _category can be a single string (indicating the primary category) or an array of categories. If an array is specified, the first element is treated as the primary category.

The set of supported category values is detailed in the IacCategorySchema reference.

Raw category value

If the _CATEGORY_NAME property is present, its value will be used directly as the category value without any schema validation. This allows Dinghy to support custom or unrecognized data structures, as well as cases where an incorrect schema might have been generated.

None primary categories only support raw category value.

_inputSchema

When no raw category difined for primary category, _inputSchema will be used to parse the component attribute as category value.

_outputSchema

_outputSchema specifies the Terraform read-only attributes—these values are only populated at runtime and cannot be set in the configuration.

_importSchema

_importSchema specifies the attributes required to uniquely identify and import an existing resource into the Terraform state when it is not already present.

The import statement is generated only when the --tf-generate-import option is enabled during rendering.