@@ -548,6 +548,34 @@ In order to generate your documentation with the right format and options, you s
As long as you don't, this job will simply generate the [pretty](https://terraform-docs.io/reference/pretty/)
doc format in the output console.
### `tf-publish-module` job
Publish your Terraform project as a module to GitLab's [Terraform Module Registry](https://docs.gitlab.com/ee/user/packages/terraform_module_registry/).
When enabled, this job triggers on a Git tag with semantic version pattern (`v?[0-9]+\.[0-9]+\.[0-9]+`, _configurable_) and publishes the module with the same version.
| `TF_PUBLISH_ENABLED` | Set to `true` to enable Terraform Module Publish | _none_ (disabled) |
| `TF_PUBLISH_IMAGE` | Container image used to publish module. | `registry.hub.docker.com/curlimages/curl:latest` |
| `TF_MODULE_NAME` | The module name. May not contain any spaces or underscores. | `$CI_PROJECT_NAME` |
| `TF_MODULE_SYSTEM` | The module system or provider (example: `local`, `aws`, `google`). | `local` |
| `TF_MODULE_VERSION` | The module version. It must be valid according to the [semantic versioning](https://semver.org/) specification. | `$CI_COMMIT_TAG` _(leave default unless you have good reasons to override)_ |
| `TF_MODULE_FILES` | Glob patterns matching files to include into the Terraform module (:warning: does not support double star). | `*.tf *.tpl *.md`|
#### Example: publish module with sub-modules
By default the template has the right configuration to publish a single module Terraform project (with `tf`, `tpl` and `md` files).
If you're willing to publish a more complex module, possibly with submodules, then you'll have to override the default `TF_MODULE_FILES` variable, with
something like the following:
```yaml
variables:
# grab submodules from modules/*, templates from templates/ and examples from examples/
"description":"Publish a Terraform module to GitLab's [Terraform Module Registry](https://docs.gitlab.com/ee/user/packages/terraform_module_registry/)",
"enable_with":"TF_PUBLISH_ENABLED",
"variables":[
{
"name":"TF_PUBLISH_IMAGE",
"description":"container image used to publish module",