Skip to main content

tharsis_terraform_module

Defines and manages a Terraform module.

Example Usage​

resource "tharsis_terraform_module" "this" {
name = "my-module"
system = "aws"
group_id = tharsis_group.top_level.id
private = true
repository_url = "https://gitlab.com/my-org/terraform-aws-my-module"
}

Behavior​

  • A module address has the form hostname/namespace/name/system, where the namespace is the path of the group that contains the module.
  • The name may contain digits, lowercase letters, hyphens, and underscores, and cannot start or end with a hyphen or underscore.
  • The combination of name and system must be unique within a group.
  • The system is usually the name of the provider the module targets, such as aws, azurerm, or google.
  • Module versions must follow Semantic Versioning 2.0 and are not managed by this resource.

Schema​

Required​

  • name (String) The name of the Terraform module.
  • system (String) The target system for the module (e.g. aws, azure, etc.).

Optional​

  • group_id (String) The ID or TRN of the parent group.
  • group_path (String, Deprecated) The group path for this module.
  • private (Boolean) Whether other groups are blocked from seeing this module. Defaults to false.
  • repository_url (String) The URL in a repository where this module is found.

Read-Only​

  • id (String) String identifier of the Terraform module.
  • last_updated (String) Timestamp when this terraform module was most recently updated by Terraform.
  • registry_namespace (String, Deprecated) The top-level group in which this module resides.
  • resource_path (String, Deprecated) The path of the parent namespace plus the name of the terraform module.

Import​

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

# A Terraform module can be imported by its TRN, which is "trn:terraform_module:"
# followed by the group path, the module name, and the target system.
import {
to = tharsis_terraform_module.this
id = "trn:terraform_module:my-group/my-module/aws"
}

# The module's ID also works as the id, shown by the "id" attribute or in the
# Tharsis UI.