Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(state []byte) ([]byte, error)
- func FindChangesInLogs(in io.Reader) (bool, error)
- func NewKubernetesBackend(options BackendOptions) ([]byte, error)
- func NewTerraformProvider(provider string, configuration []byte) ([]byte, error)
- type BackendOptions
- type ErrorDetection
- type OutputValue
- type Resource
- type State
Constants ¶
const TerraformStateOutputsKey = "outputs"
TerraformStateOutputsKey is the key for the terraform state outputs
Variables ¶
var ( // Detectors is the error detection pattern Detectors = map[string][]ErrorDetection{ "aws": { { Regex: "operation error STS: GetCallerIdentity", Message: "AWS Credentials in provider has been missconfigured, contact platform administrator", }, }, "google": {}, "azurerm": {}, "*": { { Regex: "error validating provider credentials", Message: "Provider credentials are missconfigured, please contact the platform administrator", }, }, } )
var KubernetesBackendTemplate = `` /* 170-byte string literal not displayed */
KubernetesBackendTemplate is responsible for creating the kubernetes backend terraform configuration
Functions ¶
func FindChangesInLogs ¶
FindChangesInLogs is used to scan the logs for the terraform line which informs on changes
func NewKubernetesBackend ¶
func NewKubernetesBackend(options BackendOptions) ([]byte, error)
NewKubernetesBackend creates a new kubernetes backend
Types ¶
type BackendOptions ¶ added in v0.3.1
type BackendOptions struct { // Configuration is a reference to the terraform configuration Configuration *terraformv1alphav1.Configuration // Namespace is a reference to the controller namespace Namespace string // Suffix is an expexted suffix for the terraform state Suffix string // Template is the golang template to use to generate the backend content Template string }
BackendOptions are the options used to generate the backend
type ErrorDetection ¶
type ErrorDetection struct { // Regex is the string we are looking for Regex string // Message is cause of the error Message string }
ErrorDetection defines an error and potential causes for it.
type OutputValue ¶
type OutputValue struct {
// Value is the value of the output
Value interface{} `json:"value,omitempty"`
}
OutputValue is a value of the terraform output
func (*OutputValue) String ¶
func (o *OutputValue) String() string
String returns an string representation of the value
type Resource ¶
type Resource struct { // Mode is the mode of the resource Mode string `json:"mode,omitempty"` // Type is the type of the resource Type string `json:"type,omitempty"` // Instances a collection of the resource instances in the state Instances []map[string]interface{} `json:"instances,omitempty"` }
Resource represents a resource in the state
type State ¶
type State struct { // Outputs are the terraform outputs Outputs map[string]OutputValue `json:"outputs"` // Resources is a collection of resources in the state Resources []Resource `json:"resources,omitempty"` // TerraformVersion is the version of terraform used TerraformVersion string `json:"terraform_version,omitempty"` }
State is the state of the terraform
func DecodeState ¶
DecodeState decodes the terraform state outputs
func (*State) CountResources ¶
CountResources returns the number of managed resources from the state
func (*State) HasOutputs ¶
HasOutputs returns true if the state has outputs