Skip to content

Latest commit

 

History

History
106 lines (82 loc) · 3.25 KB

README.md

File metadata and controls

106 lines (82 loc) · 3.25 KB

Random Module

Introduction

This module generates random credentials and hashes that can be used in various applications.

Requirements

Name Version
random 3.5.0
time 0.9.1

Providers

Name Version
random 3.5.0
time 0.9.1

Modules

No modules.

Resources

Name Type
random_password.multiple resource
random_password.single resource
time_rotating.multiple resource
time_rotating.single resource
time_static.multiple resource
time_static.single resource

Inputs

Name Description Type Default Required
experation A number, in days, when the password should be rotated. If none is set, the password will not rotate. number 0 no
names List of unique names for the multiple resources. list(string) [] no
passwords A map of objects with password settings. any n/a yes
per_workspace Generate a password for each workspace. bool false no

Outputs

Name Description
results A map(string) with the following attributes: result, md5, sha1sha256, and sha512.

Example

module "random" {
  source = "./modules/random"

  names = ["dev", "stage", "prod"]
  passwords = local.env.passwords
}

Usage

locals.tf

Passwords to be generated are set in local.env.passwords.

locals {
  env = {
    ...
    workspace_name = {
      ...
      passwords = {
        password1 = {
          length = 16
          special = false
        }
      }
    }
  }
}

If the attribute per_workspace is set for true, then multiple resources will be created. It will prefix each resource name with each workspace name. It is useful to set this in the bootstrap "environment", allowing the passwords to be added as pipeline variables for each environment.

locals {
  env = {
    ...
    bootstrap = {
      ...
      passwords = {
        password2 = {
          length = 32
          per_workspace = true
        }
      }
    }
  }
}

If the per_workspace value isn't set or is false, only single resource will be created.