scalr_module

Resource: scalr_module

Manages the state of a module in the Private Modules Registry. Create and destroy operations are available only. A module is sourced either from a VCS repository (vcs_repo and vcs_provider_id) or from an OCI registry (docker_image and docker_integration_id).

Example Usage

resource "scalr_module" "example" {
  namespace_id    = scalr_module_namespace.shared.id
  vcs_provider_id = "vcs-xxxxxxxxxx"
  vcs_repo {
    identifier = "org/repo"
    path       = "example/terraform-<provider>-<name>"
    tag_prefix = "aws/"
  }
}

# VCS path does not follow terraform-<provider>-<name> (e.g. extra hyphens).
# Set module_provider and name so the registry maps the module correctly.
resource "scalr_module" "example_explicit_provider_and_name" {
  namespace_id    = scalr_module_namespace.shared.id
  vcs_provider_id = "vcs-xxxxxxxxxx"

  module_provider = "couchbasecapella"
  name            = "infra"

  vcs_repo {
    identifier = "org/repo"
    path       = "example/terraform-couchbase-capella-infra"
  }
}

# Module published from an OCI registry.
resource "scalr_module" "example_oci" {
  namespace_id          = scalr_module_namespace.shared.id
  docker_integration_id = scalr_docker_integration.example.id

  module_provider = "aws"
  name            = "network"
  docker_image    = "scalr/terraform-aws-network"
}

Schema

Optional

  • account_id (String, Deprecated) The identifier of the account in the format acc-<RANDOM STRING>. If it is not specified the module will be registered globally and available across the whole installation. Deprecated: Use namespace_id instead.
  • docker_image (String) The OCI repository path of the module inside the registry configured in docker_integration_id, e.g. scalr/terraform-aws-network. The registry host prefix, e.g. ghcr.io/, is optional. Conflicts with vcs_repo.
  • docker_integration_id (String) The identifier of a Docker registry integration the module is pulled from. Required for OCI-sourced modules.
  • environment_id (String, Deprecated) The identifier of an environment in the format env-<RANDOM STRING>. If it is not specified the module will be registered at the account level and available across all environments within the account specified in account_id attribute. Deprecated: Use namespace_id instead.
  • module_provider (String) Module provider name, e.g aws, azurerm, google, etc. Required for OCI-sourced modules.
  • name (String) Name of the module, e.g. rds, compute, kubernetes-engine. Required for OCI-sourced modules.
  • namespace_id (String) The identifier of a module namespace in the format modns-<RANDOM STRING>. If specified, the module will be registered in this namespace. Conflicts with environment_id.
  • vcs_provider_id (String) The identifier of a VCS provider in the format vcs-<RANDOM STRING>. Required for VCS-sourced modules.
  • vcs_repo (Block List) Source configuration of a VCS repository. At most one block is allowed. Conflicts with docker_image. (see below for nested schema)

Read-Only

  • id (String) The ID of the module.
  • source (String) The source of a remote module in the private registry, e.g env-xxxx/aws/vpc.
  • source_type (String) The upstream source type of the module: vcs or docker.
  • status (String) A system status of the Module.

Nested Schema for vcs_repo

Required:

  • identifier (String) The identifier of a VCS repository in the format :org/:repo (:org/:project/:name is used for Azure DevOps). It refers to an organization and a repository name in a VCS provider.

Optional:

  • path (String) The path to the root module folder. It is expected to have the format <path>/terraform-<provider_name>-<module_name>, where <path> stands for any folder within the repository inclusively a repository root.
  • tag_prefix (String) Registry ignores tags which do not match specified prefix, e.g. aws/.

Import

Import is supported using the following syntax:

terraform import scalr_module.example mod-xxxxxxxxxx

Did this page help you?