driftdetector

package
v0.0.0-...-d123b64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRegionFromTfStateMap

func ParseRegionFromTfStateMap(attributes map[string]string, cloudProvider string) (string, error)

ParseRegionFromTfStateMap extracts the region value from a terraform state file attributes map.

func ResourceIDCalculator

func ResourceIDCalculator(attributesFlat map[string]string, cloudProvider string, resourceType string) (string, error)

ResourceIDCalculator determines the unique ID of a terraform resource based on attributes, cloud provider and resource type.

Types

type AttributeDetail

type AttributeDetail struct {
	StateFileName StateFileName
	ModuleName    string
	ResourceType  string
	ResourceName  string
}

AttributeDetail contains information about the resource that the attribute belongs to.

type AttributeDifference

type AttributeDifference struct {
	RecentActor           terraformValueObjects.CloudActor
	RecentActionTimestamp terraformValueObjects.Timestamp
	AttributeName         string
	TerraformValue        string
	CloudValue            string
	InstanceID            string
	InstanceRegion        string
	AttributeDetail
}

AttributeDifference contains data on the specific differences between a Cloud resource and its Terraform representation.

type DeletedResource

type DeletedResource struct {
	InstanceID    string
	StateFileName StateFileName
	ModuleName    string
	ResourceType  string
	ResourceName  string
}

DeletedResource represents a drifted deleted resource

type LoggingResourceName

type LoggingResourceName string

LoggingResourceName is the value which can be used as a ResourceName filter in a GCP log query.

type ManagedResourceDriftDetectorConfig

type ManagedResourceDriftDetectorConfig struct {
	// ResourcesWhiteList represents the list of resource names that will be exclusively considered for inclusion in the import statement.
	ResourcesWhiteList terraformValueObjects.ResourceNameList

	// ResourcesBlackList represents the list of resource names that will be excluded from consideration for inclusion in the import statement.
	ResourcesBlackList terraformValueObjects.ResourceNameList
}

ManagedResourceDriftDetectorConfig is a type that contains configuration

type ManagedResourcesDriftDetector

type ManagedResourcesDriftDetector struct {
	// contains filtered or unexported fields
}

ManagedResourcesDriftDetector is a type that identifies resources managed by Terraform that have drifted from their expected state.

func NewManagedResourcesDriftDetector

func NewManagedResourcesDriftDetector(config ManagedResourceDriftDetectorConfig) *ManagedResourcesDriftDetector

NewManagedResourcesDriftDetector generated a terraformer instance from ManagedResourcesDriftDetector

func (*ManagedResourcesDriftDetector) Execute

func (m *ManagedResourcesDriftDetector) Execute(_ context.Context, workspaceToDirectory map[string]string) (bool, error)

Execute initiates the process of detecting drift in managed resources by comparing the current state of resources with their expected state. It takes a context as input to support cancellation and timeouts.

type Resource

type Resource struct {
	Mode      string             `json:"mode"`
	Module    string             `json:"module"`
	Type      string             `json:"type"`
	Name      string             `json:"name"`
	Provider  string             `json:"provider"`
	Instances []ResourceInstance `json:"instances"`
}

Resource represents a Terraform resource within a state file.

type ResourceIdentifier

type ResourceIdentifier string

ResourceIdentifier encapsulates the resources module name string

type ResourceInstance

type ResourceInstance struct {
	SchemaVersion int                    `json:"schema_version"`
	Attributes    map[string]interface{} `json:"attributes"`
}

ResourceInstance represents a Terraform resource instance within a state file.

type StateFileName

type StateFileName string

StateFileName encapsulates the state file name string

type TerraformResourceToLoggingName

type TerraformResourceToLoggingName map[TerraformResourceType]LoggingResourceName

TerraformResourceToLoggingName is a map between a Terraform resource type and the LoggingResourceName for that resource type.

func NewGoogleTfToQueryName

func NewGoogleTfToQueryName() TerraformResourceToLoggingName

NewGoogleTfToQueryName returns a new instance of TerraformResourceToGoogleQueryParams.

type TerraformResourceType

type TerraformResourceType string

TerraformResourceType is a Terraform resource type represented by a string.

type TerraformStateFile

type TerraformStateFile struct {
	Resources []*Resource `json:"resources"`
}

TerraformStateFile represents the structure of a Terraform state file from terraform cloud.

type TerraformStateResourceIDToData

type TerraformStateResourceIDToData map[string]TerraformStateUniqueResourceData

TerraformStateResourceIDToData is a map between a resource's unique id and the terraform state files unique resource data.

type TerraformStateUniqueResourceData

type TerraformStateUniqueResourceData struct {
	StateFile  string
	Module     string
	Type       string
	Name       string
	Provider   string
	Attributes map[string]interface{}
}

TerraformStateUniqueResourceData is a struct for storing the data definition of a single Terraform State resource instance.

type TerraformerInstance

type TerraformerInstance struct {
	SchemaVersion  int               `json:"schema_version"`
	AttributesFlat map[string]string `json:"attributes_flat"`
}

TerraformerInstance represents a Terraform resource instance within a state file generated by terraformer.

type TerraformerResource

type TerraformerResource struct {
	Mode      string                `json:"mode"`
	Module    string                `json:"module"`
	Type      string                `json:"type"`
	Name      string                `json:"name"`
	Provider  string                `json:"provider"`
	Instances []TerraformerInstance `json:"instances"`
}

TerraformerResource represents a Terraform resource within a terraformer state file.

type TerraformerResourceIDToData

type TerraformerResourceIDToData map[string]TerraformerUniqueResourceData

TerraformerResourceIDToData is a map between a resource's unique id and the terraformer state files unique resource data.

type TerraformerStateFile

type TerraformerStateFile struct {
	Resources []*TerraformerResource `json:"resources"`
}

TerraformerStateFile represents the structure of a Terraform state file generated by terraformer.

func ParseTerraformerStateFile

func ParseTerraformerStateFile(stateFileContent []byte) (TerraformerStateFile, error)

ParseTerraformerStateFile parses a Terraform state file's content generated by terraformer and returns a TerraformerStateFile struct.

type TerraformerUniqueResourceData

type TerraformerUniqueResourceData struct {
	Module         string
	Type           string
	Name           string
	Provider       string
	AttributesFlat map[string]string
}

TerraformerUniqueResourceData is a struct for storing the data definition of a single Terraform State resource instance generated by terraformer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL