deployment

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(name string, storageRepoURL string, fs afero.Fs, deploymentPath string) error

Clone creates and initializes a new Deployment object that has not been created before on any repository

func Create

func Create(name string, storageRepoURL string, codeRepoURL string, codeRepoPath string,
	terraformVersion string, flavour string, fs afero.Fs, deploymentPath string) error

Create creates and initializes a new Deployment object that has not been created before on any repository

Types

type CTD

type CTD struct {
	RepoURL  string
	RepoPath string
	// contains filtered or unexported fields
}

CTD represents a Code Tree Definition

func NewCTD

func NewCTD(fs afero.Fs, path string, repoURL string, repoPath string) *CTD

NewCTD returns an initialized CTD struct TODO

func (*CTD) Checkout

func (ctd *CTD) Checkout() error

func (*CTD) Clone

func (ctd *CTD) Clone() error

func (*CTD) ListMainGlobalFiles

func (ctd *CTD) ListMainGlobalFiles() ([]string, error)

ListMainGlobalFiles returns all TF files from the global main folder

func (*CTD) ListMainUserFiles

func (ctd *CTD) ListMainUserFiles(user string) ([]string, error)

ListMainUserFiles returns all TF files from the user main folder

func (*CTD) ListModules

func (ctd *CTD) ListModules() ([]string, error)

ListModules returns all modules defined on a CTD

func (*CTD) Pull

func (ctd *CTD) Pull() error

type Deployment

type Deployment interface {
	GenerateWorkdirGlobal() (string, error)
	GenerateWorkdirUser(user string) (string, error)
	GenerateVariablesGlobal() ([]string, error)
	GenerateVariablesUser(user string) ([]string, error)
	StateFilePathGlobal() string
	StateFilePathUser(user string) string
	TerraformVersion() string
	CodeRepoURL() string
	CodeRepoPath() string
	Purge() error
}

Deployment object contains all information about a deployment TODO: improve explanation and interface definition

func Get

func Get(name string, storageRepoURL string, fs afero.Fs, deploymentPath string) (Deployment, error)

Get creates and initializes a new Deployment object from local storage

type DeploymentImpl

type DeploymentImpl struct {
	Name string

	State *State
	Vars  *Vars

	Base    *CTD
	Plugins [](*CTD) // The key is the plugin name

	Workdir *Workdir
	// contains filtered or unexported fields
}

DeploymentImpl implements Deployment interface

func (*DeploymentImpl) CodeRepoPath

func (d *DeploymentImpl) CodeRepoPath() string

CodeRepoPath returns the path inside the CodeRepo where is the terraform code that describes infrastructure to be deployed in a sonatina way.

func (*DeploymentImpl) CodeRepoURL

func (d *DeploymentImpl) CodeRepoURL() string

CodeRepoURL returns the URL where is the terraform code that describes infrastructure to be deployed in a sonatina way.

func (*DeploymentImpl) GenerateVariablesGlobal

func (d *DeploymentImpl) GenerateVariablesGlobal() ([]string, error)

func (*DeploymentImpl) GenerateVariablesUser

func (d *DeploymentImpl) GenerateVariablesUser(user string) ([]string, error)

func (*DeploymentImpl) GenerateWorkdirGlobal

func (d *DeploymentImpl) GenerateWorkdirGlobal() (string, error)

GenerateWorkdirGlobal combines deployment CTDs (main and plugins) to generate the CTD to be applied by terraform. Returns main path where terraform must be executed.

func (*DeploymentImpl) GenerateWorkdirUser

func (d *DeploymentImpl) GenerateWorkdirUser(user string) (string, error)

GenerateWorkdirUser combines deployment CTDs (main and plugins) to generate the CTD to be applied by terraform

func (*DeploymentImpl) Purge

func (d *DeploymentImpl) Purge() error

Purge removes all local files related to a deployment

func (*DeploymentImpl) StateFilePathGlobal

func (d *DeploymentImpl) StateFilePathGlobal() string

func (*DeploymentImpl) StateFilePathUser

func (d *DeploymentImpl) StateFilePathUser(user string) string

func (*DeploymentImpl) TerraformVersion

func (d *DeploymentImpl) TerraformVersion() string

TerraformVersion returns the terraform version that is being using with this specific deployment.

type Metadata

type Metadata struct {
	TerraformVersion string                   `json:"terraform_version"`
	Repo             string                   `json:"repo"`
	RepoPath         string                   `json:"repo_path"`
	Version          string                   `json:"version"`
	Commit           string                   `json:"commit"`
	Flavour          string                   `json:"flavour"`
	UserComponents   map[string]userComponent `json:"user_components"`
	Plugins          []globalPlugin           `json:"plugins"`
	// contains filtered or unexported fields
}

func (*Metadata) ListGlobalPlugins

func (m *Metadata) ListGlobalPlugins() []string

func (*Metadata) ListUserPlugins

func (m *Metadata) ListUserPlugins(user string) []string

type State

type State struct {
	RepoURL string
	// contains filtered or unexported fields
}

State manages terraform state

func (*State) FilePathGlobal

func (s *State) FilePathGlobal() string

func (*State) FilePathUser

func (s *State) FilePathUser(user string) string

func (*State) Load

func (s *State) Load()

Load method retrieves terraform state information from git repository

func (*State) Save

func (s *State) Save()

Save method stores terraform state information on git repository

type VTD

type VTD struct {
	// contains filtered or unexported fields
}

func NewVTD

func NewVTD(fs afero.Fs, path string) *VTD

type Vars

type Vars struct {
	RepoURL  string
	Metadata *Metadata
	// contains filtered or unexported fields
}

Vars manage variable and metadata

func (*Vars) GenerateGlobal

func (v *Vars) GenerateGlobal() ([]string, error)

GenerateGlobal generates vars files to be used on terraform operations. Returns a list of vars files that must be applied in order.

func (*Vars) GenerateUser

func (v *Vars) GenerateUser(user string) ([]string, error)

GenerateUser generates vars files to be used on terraform operations. Returns a list of vars files that must be applied in order.

type Workdir

type Workdir struct {
	CTD *CTD
	// contains filtered or unexported fields
}

func (*Workdir) GenerateGlobal

func (w *Workdir) GenerateGlobal() error

func (*Workdir) GenerateUser

func (w *Workdir) GenerateUser(user string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL