Documentation ¶
Index ¶
- Variables
- func Cmd(opts *CmdOptions, args ...string) ([]byte, error)
- func CreateConfigFile(dir string, terraformCloudHost string, terraformCloudToken string) (string, error)
- func GetUsageOnlyResources() []string
- func HasSupportedProvider(rType string) bool
- func IsTerraformDir(path string) bool
- func NewDirProvider(ctx *config.ProjectContext) schema.Provider
- func NewPlanProvider(ctx *config.ProjectContext) schema.Provider
- func NewStateJSONProvider(ctx *config.ProjectContext) schema.Provider
- func NewTerragruntProvider(ctx *config.ProjectContext) schema.Provider
- func ReadPlanCache(p *DirProvider) ([]byte, error)
- func StripSetupTerraformWrapper(b []byte) ([]byte, bool)
- func UsePlanCache(p *DirProvider) bool
- func WritePlanCache(p *DirProvider, planJSON []byte)
- type CmdError
- type CmdOptions
- type Configuration
- type DirProvider
- type HCLProvider
- type ModuleCall
- type ModuleConfig
- type ModuleOut
- type Parser
- type PlanJSONProvider
- func (p *PlanJSONProvider) AddMetadata(metadata *schema.ProjectMetadata)
- func (p *PlanJSONProvider) DisplayType() string
- func (p *PlanJSONProvider) LoadResources(usage map[string]*schema.UsageData) ([]*schema.Project, error)
- func (p *PlanJSONProvider) LoadResourcesFromSrc(usage map[string]*schema.UsageData, j []byte, spinner *ui.Spinner) ([]*schema.Project, error)
- func (p *PlanJSONProvider) Type() string
- type PlanModule
- type PlanProvider
- type PlanSchema
- type ProviderConfig
- type ResourceChange
- type ResourceChangesJSON
- type ResourceData
- type ResourceJSON
- type ResourceOutput
- type ResourceRegistryMap
- type RunShowOptions
- type StateJSONProvider
- type TerragruntInfo
- type TerragruntProvider
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCloudToken = errors.New("invalid Terraform Cloud Token")
var ErrMissingCloudToken = errors.New("no Terraform Cloud token is set")
Functions ¶
func CreateConfigFile ¶ added in v0.7.10
func GetUsageOnlyResources ¶ added in v0.7.12
func GetUsageOnlyResources() []string
func HasSupportedProvider ¶ added in v0.7.3
func IsTerraformDir ¶ added in v0.8.0
func NewDirProvider ¶ added in v0.8.0
func NewDirProvider(ctx *config.ProjectContext) schema.Provider
func NewPlanProvider ¶ added in v0.8.0
func NewPlanProvider(ctx *config.ProjectContext) schema.Provider
func NewStateJSONProvider ¶ added in v0.8.0
func NewStateJSONProvider(ctx *config.ProjectContext) schema.Provider
func NewTerragruntProvider ¶ added in v0.9.7
func NewTerragruntProvider(ctx *config.ProjectContext) schema.Provider
func ReadPlanCache ¶ added in v0.9.12
func ReadPlanCache(p *DirProvider) ([]byte, error)
func StripSetupTerraformWrapper ¶ added in v0.9.14
StripSetupTerraformWrapper removes any output added from the setup-terraform GitHub action terraform wrapper, so we can parse the output of this as valid JSON. It returns the stripped out JSON and a boolean that is true if the wrapper output was found and removed.
func UsePlanCache ¶ added in v0.9.12
func UsePlanCache(p *DirProvider) bool
func WritePlanCache ¶ added in v0.9.12
func WritePlanCache(p *DirProvider, planJSON []byte)
Types ¶
type CmdError ¶ added in v0.6.3
type CmdError struct { Stderr []byte // contains filtered or unexported fields }
type CmdOptions ¶ added in v0.6.2
type Configuration ¶ added in v0.9.19
type Configuration struct { ProviderConfig map[string]ProviderConfig `json:"provider_config"` RootModule ModuleConfig `json:"root_module"` }
type DirProvider ¶ added in v0.8.0
type DirProvider struct { Path string IsTerragrunt bool PlanFlags string InitFlags string Workspace string UseState bool TerraformBinary string TerraformCloudHost string TerraformCloudToken string Env map[string]string // contains filtered or unexported fields }
func (*DirProvider) AddMetadata ¶ added in v0.9.0
func (p *DirProvider) AddMetadata(metadata *schema.ProjectMetadata)
func (*DirProvider) DisplayType ¶ added in v0.8.0
func (p *DirProvider) DisplayType() string
func (*DirProvider) LoadResources ¶ added in v0.8.0
func (*DirProvider) Type ¶ added in v0.8.0
func (p *DirProvider) Type() string
type HCLProvider ¶ added in v0.9.19
type HCLProvider struct { Parser *hcl.Parser Provider *PlanJSONProvider // contains filtered or unexported fields }
func NewHCLProvider ¶ added in v0.9.19
func NewHCLProvider(ctx *config.ProjectContext, provider *PlanJSONProvider, opts ...hcl.Option) (*HCLProvider, error)
NewHCLProvider returns a HCLProvider with a hcl.Parser initialised using the config.ProjectContext. It will use input flags from either the terraform-plan-flags or top level var and var-file flags to set input vars and files on the underlying hcl.Parser.
func (*HCLProvider) AddMetadata ¶ added in v0.9.19
func (p *HCLProvider) AddMetadata(metadata *schema.ProjectMetadata)
func (*HCLProvider) DisplayType ¶ added in v0.9.19
func (p *HCLProvider) DisplayType() string
func (*HCLProvider) LoadPlanJSON ¶ added in v0.9.22
func (p *HCLProvider) LoadPlanJSON() ([]byte, error)
LoadPlanJSON parses the provided directory and returns it as a Terraform Plan JSON.
func (*HCLProvider) LoadResources ¶ added in v0.9.19
LoadResources calls a hcl.Parser to parse the directory config files into hcl.Blocks. It then builds a shallow representation of the terraform plan JSON files from these Blocks, this is passed to the PlanJSONProvider. The PlanJSONProvider uses this shallow representation to actually load Infracost resources.
func (*HCLProvider) Type ¶ added in v0.9.19
func (p *HCLProvider) Type() string
type ModuleCall ¶ added in v0.9.19
type ModuleCall struct { Source string `json:"source"` ModuleConfig ModuleConfig `json:"module"` }
type ModuleConfig ¶ added in v0.9.22
type ModuleConfig struct { Resources []ResourceData `json:"resources,omitempty"` ModuleCalls map[string]ModuleCall `json:"module_calls,omitempty"` }
type ModuleOut ¶ added in v0.9.22
type ModuleOut struct { PlanModule PlanModule ModuleConfig ModuleConfig }
type Parser ¶ added in v0.7.17
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶ added in v0.7.17
func NewParser(ctx *config.ProjectContext) *Parser
type PlanJSONProvider ¶ added in v0.8.0
type PlanJSONProvider struct { Path string // contains filtered or unexported fields }
func NewPlanJSONProvider ¶ added in v0.8.0
func NewPlanJSONProvider(ctx *config.ProjectContext) *PlanJSONProvider
func (*PlanJSONProvider) AddMetadata ¶ added in v0.9.0
func (p *PlanJSONProvider) AddMetadata(metadata *schema.ProjectMetadata)
func (*PlanJSONProvider) DisplayType ¶ added in v0.8.0
func (p *PlanJSONProvider) DisplayType() string
func (*PlanJSONProvider) LoadResources ¶ added in v0.8.0
func (*PlanJSONProvider) LoadResourcesFromSrc ¶ added in v0.9.19
func (*PlanJSONProvider) Type ¶ added in v0.8.0
func (p *PlanJSONProvider) Type() string
type PlanModule ¶ added in v0.9.22
type PlanModule struct { Resources []ResourceJSON `json:"resources,omitempty"` Address *string `json:"address,omitempty"` ChildModules []PlanModule `json:"child_modules,omitempty"` }
type PlanProvider ¶ added in v0.8.0
type PlanProvider struct { *DirProvider Path string // contains filtered or unexported fields }
func (*PlanProvider) DisplayType ¶ added in v0.8.0
func (p *PlanProvider) DisplayType() string
func (*PlanProvider) LoadResources ¶ added in v0.8.0
func (*PlanProvider) Type ¶ added in v0.8.0
func (p *PlanProvider) Type() string
type PlanSchema ¶ added in v0.9.19
type PlanSchema struct { FormatVersion string `json:"format_version"` TerraformVersion string `json:"terraform_version"` Variables interface{} `json:"variables,omitempty"` PlannedValues struct { RootModule PlanModule `json:"root_module"` } `json:"planned_values"` ResourceChanges []ResourceChangesJSON `json:"resource_changes"` Configuration Configuration `json:"configuration"` }
type ProviderConfig ¶ added in v0.9.19
type ResourceChange ¶ added in v0.9.19
type ResourceChangesJSON ¶ added in v0.9.19
type ResourceData ¶ added in v0.9.19
type ResourceData struct { Address string `json:"address"` Mode string `json:"mode"` Type string `json:"type"` Name string `json:"name"` ProviderConfigKey string `json:"provider_config_key"` Expressions map[string]interface{} `json:"expressions,omitempty"` SchemaVersion int `json:"schema_version"` CountExpression *countExpression `json:"count_expression,omitempty"` }
type ResourceJSON ¶ added in v0.9.19
type ResourceOutput ¶ added in v0.9.22
type ResourceOutput struct { Planned ResourceJSON Changes ResourceChangesJSON Configuration ResourceData }
type ResourceRegistryMap ¶ added in v0.6.3
type ResourceRegistryMap map[string]*schema.RegistryItem
func GetResourceRegistryMap ¶ added in v0.6.0
func GetResourceRegistryMap() *ResourceRegistryMap
func (*ResourceRegistryMap) GetCustomRefIDFunc ¶ added in v0.9.19
func (r *ResourceRegistryMap) GetCustomRefIDFunc(resourceDataType string) schema.ReferenceIDFunc
func (*ResourceRegistryMap) GetReferenceAttributes ¶ added in v0.9.19
func (r *ResourceRegistryMap) GetReferenceAttributes(resourceDataType string) []string
type RunShowOptions ¶ added in v0.9.7
type RunShowOptions struct {
CmdOptions *CmdOptions
}
type StateJSONProvider ¶ added in v0.8.0
type StateJSONProvider struct { Path string // contains filtered or unexported fields }
func (*StateJSONProvider) AddMetadata ¶ added in v0.9.0
func (p *StateJSONProvider) AddMetadata(metadata *schema.ProjectMetadata)
func (*StateJSONProvider) DisplayType ¶ added in v0.8.0
func (p *StateJSONProvider) DisplayType() string
func (*StateJSONProvider) LoadResources ¶ added in v0.8.0
func (*StateJSONProvider) Type ¶ added in v0.8.0
func (p *StateJSONProvider) Type() string
type TerragruntInfo ¶ added in v0.9.7
type TerragruntProvider ¶ added in v0.9.7
type TerragruntProvider struct { Path string TerragruntFlags string *DirProvider // contains filtered or unexported fields }
func (*TerragruntProvider) AddMetadata ¶ added in v0.9.7
func (p *TerragruntProvider) AddMetadata(metadata *schema.ProjectMetadata)
func (*TerragruntProvider) DisplayType ¶ added in v0.9.7
func (p *TerragruntProvider) DisplayType() string
func (*TerragruntProvider) LoadResources ¶ added in v0.9.7
func (*TerragruntProvider) Type ¶ added in v0.9.7
func (p *TerragruntProvider) Type() string