Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(data []byte) (io.Reader, error)
- func FindChangesInLogs(in io.Reader) (bool, error)
- func NewCheckovPolicy(data map[string]interface{}) ([]byte, error)
- func NewKubernetesBackend(options BackendOptions) ([]byte, error)
- func NewTerraformProvider(provider string, configuration []byte) ([]byte, error)
- func Template(main string, data interface{}) ([]byte, error)
- func ToHCL(data interface{}) (string, error)
- type BackendOptions
- type Change
- type ChangeAction
- type ErrorDetection
- type OutputChange
- type OutputValue
- type Plan
- type Resource
- type ResourceChange
- type State
Constants ¶
const TerraformStateOutputsKey = "outputs"
TerraformStateOutputsKey is the key for the terraform state outputs
Variables ¶
var ( // CheckovPolicyTemplate is the default template used to produce a checkov configuration CheckovPolicyTemplate = `` /* 441-byte string literal not displayed */ )
checkovPolicyTemplate is the default template used to produce a checkov configuration
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 = `` /* 340-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 NewCheckovPolicy ¶ added in v0.4.0
NewCheckovPolicy generates a checkov policy from the configuration
func NewKubernetesBackend ¶
func NewKubernetesBackend(options BackendOptions) ([]byte, error)
NewKubernetesBackend creates a new kubernetes backend
func NewTerraformProvider ¶
NewTerraformProvider generates a terraform provider configuration
Types ¶
type BackendOptions ¶ added in v0.3.1
type BackendOptions struct { // Configuration is a reference to the terraform configuration Configuration *terraformv1alpha1.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 Change ¶ added in v0.4.10
type Change struct {
Actions []ChangeAction `json:"actions"`
}
type ChangeAction ¶ added in v0.4.10
type ChangeAction string
const (
TFActionNoOp ChangeAction = "no-op"
)
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 OutputChange ¶ added in v0.4.10
type OutputChange struct {
Actions []ChangeAction `json:"actions"`
}
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 Plan ¶ added in v0.4.10
type Plan struct { Timestamp string `json:"timestamp"` ResourceChanges []ResourceChange `json:"resource_changes"` OutputChanges map[string]OutputChange `json:"output_changes"` Applyable *bool `json:"applyable"` }
Plan is the terraform plan output
func DecodePlan ¶ added in v0.4.10
DecodePlan decodes the terraform plan outputs
func (Plan) ID ¶ added in v0.4.10
ID uniquely identifies a plan and should be safe to use in a resource label.
func (Plan) NeedsApply ¶ added in v0.4.10
NeedsApply returns a boolean indicating if running apply is necessary
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 ResourceChange ¶ added in v0.4.10
type ResourceChange struct {
Change Change `json:"change"`
}
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