Documentation
¶
Index ¶
- func EqualAttributes(a []interface{}, b []interface{}, alist AttrList) bool
- func EqualSets(a []interface{}, b []interface{}) bool
- func RenderDriftTable(resName string, resources map[string]*ResourceConfig, cloudName string, ...) error
- type AttrList
- type Attribute
- type BaseConfig
- type Drift
- type IACConfig
- type Parser
- type ProviderConfig
- type Resource
- type ResourceACL
- type ResourceConfig
- type ResourceList
- type ResourceSelector
- type ResourceSelectors
- type Result
- type Results
- type RunParams
- type TFInstances
- type TFStates
- type TerraformBackend
- type TerraformSourceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualAttributes ¶ added in v0.15.11
func RenderDriftTable ¶ added in v0.15.11
func RenderDriftTable(resName string, resources map[string]*ResourceConfig, cloudName string, alist AttrList, differentIDs, tfRes ResourceList) error
Types ¶
type BaseConfig ¶
type BaseConfig struct {
WildProvider *ProviderConfig
Providers []*ProviderConfig `hcl:"provider,block"`
Terraform *TerraformSourceConfig `hcl:"terraform,block"`
}
func (*BaseConfig) FindProvider ¶ added in v0.15.11
func (b *BaseConfig) FindProvider(name string) *ProviderConfig
type Drift ¶
type Drift struct {
// contains filtered or unexported fields
}
func (*Drift) ExampleConfig ¶ added in v0.15.11
func (*Drift) Execute ¶
func (d *Drift) Execute(ctx context.Context, req *module.ExecuteRequest) *module.ExecutionResult
type Parser ¶
type Parser struct {
HCLContext *hcl.EvalContext
// contains filtered or unexported fields
}
func (*Parser) Decode ¶
func (p *Parser) Decode(body hcl.Body, diags hcl.Diagnostics) (*BaseConfig, hcl.Diagnostics)
type ProviderConfig ¶
type ProviderConfig struct {
WildResource *ResourceConfig
Name string `hcl:"name,label"`
Resources map[string]*ResourceConfig `hcl:"resource,block"`
Version string `hcl:"version,optional"`
IgnoreResources ResourceSelectors `hcl:"ignore_resources,optional"`
CheckResources ResourceSelectors `hcl:"check_resources,optional"`
AccountIDs []string `hcl:"account_ids,optional"`
// contains filtered or unexported fields
}
type ResourceACL ¶ added in v0.15.11
type ResourceACL struct {
// AllowEnabled determines whether allow list is enabled (Allow contains entries) or not
AllowEnabled bool
// Allow contains the allow list for resources
Allow ResourceSelectors
// Ignore contains the ignore list for resources
Ignore ResourceSelectors
}
ResourceACL manages resource allow and ignore lists
func (ResourceACL) HasTagFilters ¶ added in v0.15.11
func (r ResourceACL) HasTagFilters() bool
HasTagFilters returns true if the ACL contains tag filters
func (ResourceACL) ShouldSkip ¶ added in v0.15.11
func (r ResourceACL) ShouldSkip(resource *Resource) bool
ShouldSkip gets a resource and compares it to the ACL, returning whether the given resource should be skipped or not
type ResourceConfig ¶
type ResourceConfig struct {
Identifiers []string `hcl:"identifiers,optional"`
IgnoreIdentifiers []string `hcl:"ignore_identifiers,optional"`
Attributes []string `hcl:"attributes,optional"`
IgnoreAttributes []string `hcl:"ignore_attributes,optional"`
Deep *bool `hcl:"deep,optional"` // Check attributes if true, otherwise just match identifiers
Filters []string `hcl:"filters,optional"` // SQL filters to exclude cloud providers default resources
Sets []string `hcl:"sets,optional"` // Unordered list-attributes where item order doesn't matter
IAC map[iacProvider]*IACConfig
// contains filtered or unexported fields
}
type ResourceList ¶
type ResourceList []*Resource
func (ResourceList) IDs ¶
func (r ResourceList) IDs(exclude ...*Resource) []string
func (ResourceList) Map ¶ added in v0.15.11
func (r ResourceList) Map() map[string][]interface{}
Map returns a map of ID vs. attributes
type ResourceSelector ¶ added in v0.15.11
type ResourceSelectors ¶ added in v0.15.11
type ResourceSelectors []*ResourceSelector
func (ResourceSelectors) AllInstances ¶ added in v0.15.11
func (t ResourceSelectors) AllInstances() bool
func (ResourceSelectors) ByType ¶ added in v0.15.11
func (t ResourceSelectors) ByType(resourceType string) ResourceSelectors
func (ResourceSelectors) ContainsInstance ¶ added in v0.15.11
func (t ResourceSelectors) ContainsInstance(id string) bool
func (ResourceSelectors) ContainsTags ¶ added in v0.15.11
func (t ResourceSelectors) ContainsTags(tags map[string]string) bool
func (ResourceSelectors) HasTags ¶ added in v0.15.11
func (t ResourceSelectors) HasTags() bool
type Result ¶
type Result struct {
Provider string `json:"provider"`
ResourceType string `json:"resource_type"`
// Deep mode
Different ResourceList `json:"diff,omitempty"` // Resources don't match fully (id + attributes don't match)
DeepEqual ResourceList `json:"deep_equal,omitempty"` // Resource exists in both places (attributes match)
// Shallow mode
Equal ResourceList `json:"equal,omitempty"` // Resource exists in both places (attributes not checked)
// Both modes
Missing ResourceList `json:"missing"` // Missing in cloud provider, defined in iac
Extra ResourceList `json:"extra"` // Exists in cloud provider, not defined in iac
}
type Results ¶
type Results struct {
IACName string `json:"iac"`
Data []*Result `json:"data"`
// Options
ListManaged bool `json:"-"` // Show or hide Equal/DeepEqual output
Debug bool `json:"-"` // Print debug output regarding results
// These fields are calculated
Drifted int `json:"drifted_res"`
Covered int `json:"covered_res"`
Total int `json:"total_res"`
Coverage float64 `json:"coverage_pct"`
Text string `json:"-"`
}
type TFInstances ¶ added in v0.15.11
func (TFInstances) AsResourceList ¶ added in v0.15.11
func (r TFInstances) AsResourceList(identifiers []string, alist AttrList, path string) ResourceList
AsResourceList returns a map of resource ID vs. attributes
type TerraformBackend ¶ added in v0.15.11
type TerraformBackend string
const ( TFLocal TerraformBackend = "local" TFS3 TerraformBackend = "s3" )
func (TerraformBackend) Valid ¶ added in v0.15.11
func (t TerraformBackend) Valid() bool
type TerraformSourceConfig ¶ added in v0.15.11
type TerraformSourceConfig struct {
Backend TerraformBackend `hcl:"backend"`
// S3 backend
Bucket string `hcl:"bucket,optional"`
Keys []string `hcl:"keys,optional"`
Region string `hcl:"region,optional"`
RoleARN string `hcl:"role_arn,optional"`
// Local backend
Files []string `hcl:"files,optional"`
}
func (TerraformSourceConfig) Validate ¶ added in v0.15.11
func (c TerraformSourceConfig) Validate() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.