Categorygithub.com/GoogleCloudPlatform/deploystack
modulepackage
1.12.8
Repository: https://github.com/googlecloudplatform/deploystack.git
Documentation: pkg.go.dev

# README

DeployStack

GoDoc

DeployStack is a one click solution for running Terraform projects for Google Cloud Platfom using Cloud Shell. It uses Open in Cloud Shell to guide users from a link to a series or questions to help them install a Terraform solution in their own Google Cloud Platform project space - prompting them to choose answers to questions like "What [datacenter] zone do you want to install in?" And presenting the options to guide them to pic the settings that are right for them.

DeployStack UX

For technical reasons, at this time, it is limited to working with github repos owned by Google Cloud Platform. You can see a list of DeployStack projects on cloud.google.com.

Authoring

Authoring information has been moved to deploystack/AUTHORING.MD.

This Codebase

This project is to centralize all of the tools and processes to get terminal interfaces for collecting information from users for use with DeployStack. Ultimately this codebase creates an executable that runs on Cloud Shell and works with other tools to drive the experience.

It's broken up into packages with different responsibilities:

deploystack
A top level package that ties together user i/o for the executable and passes information to the other packages
deploystack/config
The basic information schema that runs all of the other parts of the executable.
deploystack/gcloud
Communication with Google Cloud via the Go SDK to get things like region and zone lists
deploystack/github
Communication with Github for cloning and getting other metadata about projects
deploystack/terraform
Introspection of Terraform files for tooling and other metadata
deploystack/tui
A terminal user interface that is dynamically built based on config files rendered using BubbleTea , LipGloss, and Bubbles

Testing this Repo

In order to test the helper app in this repo, we need to do a fair amount of manipulation of projects and what not. The tests require a Service Account key json file. To faciliate this there is a script in tools/credsfile that will create a service account, give it the right access and service enablements, and export out a key file to use with testing.

This is not an offical Google product.

# Packages

No description provided by the author
Package config holds all of the data structures for DeployStack.
The dsexec binary that runs on Cloud Shell to present all of the options to users.
Package dstester is a collection of tools to make testing Terraform resources created for DeployStack easier.
Package gcloud wraps up all of the cloud operations for DeployStack into one client.
Package github includes all of the client calls to github for building automation tools for deploystack.
Package terraform handles parsing Terraform files to extract structured information out of it, to support a few tools to speed up the DeployStack authoring process.
Package tui provides a BubbleTea powered tui for Deploystack.

# Functions

AttemptRepo will try to download a repo - only from GoogleCloudPlatform.
ContactCheck checks the local file system for a file containing domain registar contact info.
ContactSave writes a file containing domain registar contact info to disk if it exists.
DownloadRepo takes a name of a GoogleCloudPlatform repo or a GoogleCloudPlatform/deploystack-[name] repo, and downloads it into a unique folder name, and outputs that name.
Init initializes a Deploystack stack by looking on the local file system.
NewMeta allows project to point at local directories for info as well as pulling down from github.
Precheck handles the logic around switching working directories for multiple stacks in one repo.
UniquePath returns either the input candidate path if it does not exist, or a path like the input candidate with increasing numbers appended to it until the output name is a path that does not exist.
WriteConfig will drop a .deploystack folder with deploystack.yaml file for repos that do not have one.

# Structs

Meta is a datastructure that combines the Deploystack, github and Terraform bits of metadata about a stack.