Apply for invite to IaCP

How do I call a private module in Scalr IaCP?

If your template calls modules then the module source has to be accessible from Scalr so it can be pulled into the workspace at run time.

Example:

module "scalr_dynamic_vpc_dns" {
  source  = "github/scalr-eap/scalr_dynamic_vpc_dns"
...

There are 2 ways to make this work in Scalr.

Option 1: Modules and Template in the same VCS system

In Scalr you can set up VCS provider credentials to enable Scalr to pull templates (VCS integrated workspaces, template registry).

../_images/how_to_mod_1.png

If the module calls in your template are from the same VCS provider then Scalr will automatically pull the module using the same access token. No changes need to be made to the template.

Option 2 : Modules from other repositories

If the module source is not in the same VCS provider as the template you can use the Scalr Module Registry to pull the module.

Note

The module registry and VCS providers can be configured at any scope and inherited by lower scopes.

  • Create a VCS Provider for the module repo

    ../_images/how_to_mod_2.png
  • Register your module

    ../_images/how_to_mod_3.png
  • Scalr generates an internal source reference for the module and provides the boiler plate code, including input variables so you can add the call to your template.

    ../_images/how_to_mod_4.png
module "scalr_dynamic_vpc_dns" {
  source  = "my.scalr.com/org-sgncvo4mr5l4na0/scalr_dynamic_vpc_dns/aws"
  version = "1.0.0"

  cidr              = var.cidr
  prefix            = var.prefix
  public            = var.public
  max_subnets       = var.max_subnets
}

Related documenation : Module Private Registry