Documentation ¶
Index ¶
- func Deploy(opts *DeployOptions) *router.Router
- func Outputs(path string) (map[string]string, error)
- func Project(ctx *context.Shared) (*hashitools.Project, error)
- type DeployArtifactExtractor
- type DeployOptions
- type Foundation
- type Infrastructure
- func (i *Infrastructure) Compile(ctx *infrastructure.Context) (*infrastructure.CompileResult, error)
- func (i *Infrastructure) Creds(ctx *infrastructure.Context) (map[string]string, error)
- func (i *Infrastructure) Execute(ctx *infrastructure.Context) error
- func (i *Infrastructure) Flavors() []string
- func (i *Infrastructure) VerifyCreds(ctx *infrastructure.Context) error
- type Terraform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deploy ¶
func Deploy(opts *DeployOptions) *router.Router
Deploy can be used as an implementation of app.App.Deploy to handle calling out to terraform w/ the configured config to get an app deployed to an infrastructure.
This will verify the infrastructure is created and a build is available, and use that information to run Terraform. Any edge cases around Terraform failures is handled and state storage is automatic as well.
This function implements app.App.Deploy.
Types ¶
type DeployArtifactExtractor ¶
type DeployArtifactExtractor func( *app.Context, *directory.Build, *directory.Infra) (map[string]string, error)
DeployArtifactExtractor is the function type that is used to extract artifacts from a Build for deploys.
type DeployOptions ¶
type DeployOptions struct { // Dir is the directory where Terraform is run. If this isn't set, it'll // default to "#{ctx.Dir}/deploy". Dir string // DisableBuild, if true, will not load a build associated with this // appfile and attempt to extract the artifact from it. In this case, // AritfactExtractors is also useless. DisableBuild bool // ArtifactExtractors is a mapping of artifact extractors. The // built-in artifact extractors will populate this if a key isn't set. ArtifactExtractors map[string]DeployArtifactExtractor // InfraOutputMap is a map to change the key of an infra output // to a different key for a Terraform variable. The key of this map // is the infra output key, and teh value is the Terraform variable name. InfraOutputMap map[string]string }
type Foundation ¶
type Foundation struct { // Dir is the directory where Terraform is run. If this isn't set, it'll // default to "#{ctx.Dir}/deploy". Dir string }
Foundation is a helper for various operations a foundation must perform with Terraform.
func (*Foundation) Infra ¶
func (f *Foundation) Infra(ctx *foundation.Context) error
Infra manages a foundation using Terraform.
This will verify the infrastruction is created and use that information to execute Terraform with the options given.
This function implements foundation.Foundation.Infra.
type Infrastructure ¶
type Infrastructure struct { // Creds is a function that gathers credentials. See helper/creds // for nice helpers for implementing this function. CredsFunc func(*infrastructure.Context) (map[string]string, error) // VerifyCreds is a function that verifies credentials are in good // working order. VerifyCredsFunc func(*infrastructure.Context) error // Bindata is the bindata.Data structure where assets can be found // for compilation. The data for the various flavors is expected to // live in "data/#{flavor}" Bindata *bindata.Data // Variables are additional variables to pass into Terraform. Variables map[string]string }
Infrastructure implements infrastructure.Infrastructure and is a higher level framework for writing infrastructure implementations that use Terraform.
This implementation will automatically:
- Save/restore state files via the directory service
- Populate infrastructure data in the directory (w/ Terraform outputs)
- Handle many edge case scenarios gracefully
func (*Infrastructure) Compile ¶
func (i *Infrastructure) Compile(ctx *infrastructure.Context) (*infrastructure.CompileResult, error)
TODO: test
func (*Infrastructure) Creds ¶
func (i *Infrastructure) Creds(ctx *infrastructure.Context) (map[string]string, error)
func (*Infrastructure) Execute ¶
func (i *Infrastructure) Execute(ctx *infrastructure.Context) error
func (*Infrastructure) VerifyCreds ¶
func (i *Infrastructure) VerifyCreds(ctx *infrastructure.Context) error
type Terraform ¶
type Terraform struct { // Path is the path to Terraform itself. If empty, "terraform" // will be used and looked up via the PATH var. Path string // Dir is the working directory where all Terraform commands are executed Dir string // Ui, if given, will be used to stream output from the Terraform commands. // If this is nil, then the output will be logged but won't be visible // to the user. Ui ui.Ui // Variables is a list of variables to pass to Terraform. Variables map[string]string // Directory can be set to point to a directory where data can be // stored. If this is set, then the state will be loaded/stored here // automatically. // // StateId is the identifier used to load/store the state from // blob storage. If this is empty, state won't be loaded or stored // automatically. // // It is highly recommended to use this instead of manually attempting // to manage state since this will properly handle storing the state // in the issue of an error and will put the state in the pwd in the // case we can't write it to a directory. Directory directory.Backend StateId string }
Terraform wraps `terraform` execution into an easy-to-use API