# README

deploystack/config

GoDoc

The subpackage manages all of the configuration details for DeployStack.

DeployStack Config Settings

NameTypeDescription
titlestringYou know what a title is
durationnumberAn estimate as to how long this installation takes
descriptionstringA text explanation of the stack. Useful in yaml config, as it can contain formatting.
collect_projectbooleanWhether or not to walk the user through picking or creating a project.
collect_regionbooleanWhether or not to walk the user through picking a regions
register_domainbooleanWhether or not to walk the user through registering a domain
configure_gce_instancebooleanWhether or not to walk the user through configuring a compute engine instance
region_typestringWhich product to select a region for
Options: compute, run, functions
region_defaultstringThe highlighted and default choice for region.
collect_zonestringWhether or not to walk the user through picking a zone
hard_settingsDeprecated Use author_settings below Hard Settings are for key value pairs to hardset and not get from the user.
"basename":"appprefix"
prepend_projectboolWhether or not to prepend the project id to the default value. Useful for resources like buckets that have to have globally unique names.
path_terraformstringPath that DeployStack should regard as the terraform folder.
path_messagesstringPath that DeployStack should look for messages, description and success.
path_scriptsstringPath that DeployStack should look for scripts that can be injected into DeployStack routine.
author_settingsDocumentation Below Author Settings are collections of settings that we would not like to prompt a user for.
custom_settingsDocumentation Below Custom Settings are collections of settings that we would like to prompt a user for.
projectsDocumentation Below Projects are a list of projects with settings that will surface the project selector interface for.
productsDocumentation Below Products are a list of products or other labels for structured documentation

Author Settings Options

NameTypeDescription
namestringThe name of the variable
valuestringThe value of the varible as a string
typestringA Terraform type that will be set in the terraform.tfvars file when deploystack is done: string, number, bool, list, map
list[]stringIf type is list, you populate this with an array to populate the eventual setting - leave value blank
mapmap[string]string]If type is map, you populate this with an map to populate the eventual setting - leave value blank

Custom Settings Options

NameTypeDescription
namestringThe name of the variable
descriptionstringThe description of the variable to prompt the user with
defaultstringA default value for the variable.
optionsarrayAn array of options to turn this into a custom select interface
Note Optionally you can pass a | to divide an option into a value and a label like so:
"weirdConfigSetting|User Readable Label"

Projects Settings Options

NameTypeDescription
allow_duplicatesboolWhether or not a user can use the same project multiple times, defaults to false

Project Settings Options

NameTypeDescription
variable_namestringThe name of the variable
user_promptstringThe description of the variable to prompt the user with
set_as_defaultstringWhether or not to set this as the default project for the user

Product Settings Options

NameTypeDescription
productstringThe name of a product or other label for part of a solution. Used to add structured documentation.
infostringThe description of the product or other label.

UI Controls

Header

title: "A Sample Stack"
name: "sample"
duration: 9 
documentation_link: "https://cloud.google.com/shell/docs/cloud-shell-tutorials/deploystack"
products :
- info: "VM template" 
  product: "Instance Template"   
- info: "Clustering" 
  product: "Managed Instance Group"   
- info: "Load Balancing" 
  product: "Load Balancer"       
description:  | 
  This is additional stuff that will go here and be formatted. 
  * You can add a bullet list
  * That's totally cool

UI for Project Selector

Project Selector

collect_project: true

UI for Project Selector

Region Selector

collect_region: true
region_type: "run"
region_default: "us-central1"

UI for Region Selector

Zone Selector

collect_zone: true

UI for Zone Selector

Custom Settings - no options

custom_settings:
  - name : "nodes"
    description: "Please enter the number of nodes"
    default: 3

UI for Custom Settings with no options

Custom Settings - options

custom_settings:
  - name : "nodes2"
    description: "Please enter the number of nodes"
    default: 3
    options: ["1", "2", "3"]

UI for Custom Settings with options

Domain Registration

register_domain: truee

UI for Domain Registration

# Functions

FindConfigReports walks through a directory and finds all of the configs in the folder.
NewConfigJSON returns a Config object from a file read.
NewConfigYAML returns a Config object from a file read.
NewReport Generates a new config report for a given file.
NewStack returns an initialized Stack.

# Variables

ErrConfigNotExist is what happens when a config file either does not exist or exists but is not readable.

# Structs

Config represents the settings this app will collect from a user.
Custom represents a custom setting that we would like to collect from a user We will collect these settings from the user before continuing.
Product is some info about a GCP product.
Project represets a GCP project for use in a stack.
Projects is a list of projects that we will collect info for.
Report is collection of data about multiple configs in the same root used for multi stack repos.
Setting is a item that will be translated to a variable in a terraform file.
Stack represents the input config and output settings for this DeployStack.

# Type aliases

Customs are a slice of Custom variables.
Settings are a collection of setting.