config

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultAwsResourceExclusionTagKey   = "cloud-nuke-excluded"
	DefaultAwsResourceExclusionTagValue = "true"
	CloudNukeAfterExclusionTagKey       = "cloud-nuke-after"
	CloudNukeAfterTimeFormat            = time.RFC3339
	CloudNukeAfterTimeFormatLegacy      = time.DateTime
)

Variables

This section is empty.

Functions

func ParseTimestamp added in v0.37.2

func ParseTimestamp(timestamp string) (*time.Time, error)

func ShouldInclude added in v0.1.26

func ShouldInclude(name *string, includeREs []Expression, excludeREs []Expression) bool

ShouldInclude - Checks if a resource's Name should be included according to the inclusion and exclusion rules

Types

type AWSProtectectableResourceType added in v0.40.0

type AWSProtectectableResourceType struct {
	ResourceType             `yaml:",inline"`
	IncludeDeletionProtected bool `yaml:"include_deletion_protected"`
}

type Config

type Config struct {
	ACM                             ResourceType                  `yaml:"ACM"`
	ACMPCA                          ResourceType                  `yaml:"ACMPCA"`
	AMI                             ResourceType                  `yaml:"AMI"`
	APIGateway                      ResourceType                  `yaml:"APIGateway"`
	APIGatewayV2                    ResourceType                  `yaml:"APIGatewayV2"`
	AccessAnalyzer                  ResourceType                  `yaml:"AccessAnalyzer"`
	AutoScalingGroup                ResourceType                  `yaml:"AutoScalingGroup"`
	AppRunnerService                ResourceType                  `yaml:"AppRunnerService"`
	BackupVault                     ResourceType                  `yaml:"BackupVault"`
	ManagedPrometheus               ResourceType                  `yaml:"ManagedPrometheus"`
	CloudWatchAlarm                 ResourceType                  `yaml:"CloudWatchAlarm"`
	CloudWatchDashboard             ResourceType                  `yaml:"CloudWatchDashboard"`
	CloudWatchLogGroup              ResourceType                  `yaml:"CloudWatchLogGroup"`
	CloudMapNamespace               ResourceType                  `yaml:"CloudMapNamespace"`
	CloudMapService                 ResourceType                  `yaml:"CloudMapService"`
	CloudtrailTrail                 ResourceType                  `yaml:"CloudtrailTrail"`
	CloudfrontDistribution          ResourceType                  `yaml:"CloudfrontDistribution"`
	CloudFormationStack             ResourceType                  `yaml:"CloudFormationStack"`
	CodeDeployApplications          ResourceType                  `yaml:"CodeDeployApplications"`
	ConfigServiceRecorder           ResourceType                  `yaml:"ConfigServiceRecorder"`
	ConfigServiceRule               ResourceType                  `yaml:"ConfigServiceRule"`
	DataSyncLocation                ResourceType                  `yaml:"DataSyncLocation"`
	DataSyncTask                    ResourceType                  `yaml:"DataSyncTask"`
	DBGlobalClusters                ResourceType                  `yaml:"DBGlobalClusters"`
	DBClusters                      AWSProtectectableResourceType `yaml:"DBClusters"`
	DBInstances                     AWSProtectectableResourceType `yaml:"DBInstances"`
	DBGlobalClusterMemberships      ResourceType                  `yaml:"DBGlobalClusterMemberships"`
	DBSubnetGroups                  ResourceType                  `yaml:"DBSubnetGroups"`
	DynamoDB                        ResourceType                  `yaml:"DynamoDB"`
	EBSVolume                       ResourceType                  `yaml:"EBSVolume"`
	ElasticBeanstalk                ResourceType                  `yaml:"ElasticBeanstalk"`
	EC2                             ResourceType                  `yaml:"EC2"`
	EC2DedicatedHosts               ResourceType                  `yaml:"EC2DedicatedHosts"`
	EC2DHCPOption                   ResourceType                  `yaml:"EC2DhcpOption"`
	EC2KeyPairs                     ResourceType                  `yaml:"EC2KeyPairs"`
	EC2IPAM                         ResourceType                  `yaml:"EC2IPAM"`
	EC2IPAMPool                     ResourceType                  `yaml:"EC2IPAMPool"`
	EC2IPAMResourceDiscovery        ResourceType                  `yaml:"EC2IPAMResourceDiscovery"`
	EC2IPAMScope                    ResourceType                  `yaml:"EC2IPAMScope"`
	EC2Endpoint                     ResourceType                  `yaml:"EC2Endpoint"`
	EC2Subnet                       EC2ResourceType               `yaml:"EC2Subnet"`
	EC2PlacementGroups              ResourceType                  `yaml:"EC2PlacementGroups"`
	EgressOnlyInternetGateway       ResourceType                  `yaml:"EgressOnlyInternetGateway"`
	ECRRepository                   ResourceType                  `yaml:"ECRRepository"`
	ECSCluster                      ResourceType                  `yaml:"ECSCluster"`
	ECSService                      ResourceType                  `yaml:"ECSService"`
	EKSCluster                      ResourceType                  `yaml:"EKSCluster"`
	ELBv1                           ResourceType                  `yaml:"ELBv1"`
	ELBv2                           ResourceType                  `yaml:"ELBv2"`
	ElasticFileSystem               ResourceType                  `yaml:"ElasticFileSystem"`
	ElasticIP                       ResourceType                  `yaml:"ElasticIP"`
	Elasticache                     ResourceType                  `yaml:"Elasticache"`
	ElasticacheParameterGroups      ResourceType                  `yaml:"ElasticacheParameterGroups"`
	ElasticCacheServerless          ResourceType                  `yaml:"ElasticCacheServerless"`
	ElasticacheSubnetGroups         ResourceType                  `yaml:"ElasticacheSubnetGroups"`
	EventBridge                     ResourceType                  `yaml:"EventBridge"`
	EventBridgeArchive              ResourceType                  `yaml:"EventBridgeArchive"`
	EventBridgeRule                 ResourceType                  `yaml:"EventBridgeRule"`
	EventBridgeSchedule             ResourceType                  `yaml:"EventBridgeSchedule"`
	EventBridgeScheduleGroup        ResourceType                  `yaml:"EventBridgeScheduleGroup"`
	Grafana                         ResourceType                  `yaml:"Grafana"`
	GuardDuty                       ResourceType                  `yaml:"GuardDuty"`
	IAMGroups                       ResourceType                  `yaml:"IAMGroups"`
	IAMPolicies                     ResourceType                  `yaml:"IAMPolicies"`
	IAMInstanceProfiles             ResourceType                  `yaml:"IAMInstanceProfiles"`
	IAMRoles                        ResourceType                  `yaml:"IAMRoles"`
	IAMServiceLinkedRoles           ResourceType                  `yaml:"IAMServiceLinkedRoles"`
	IAMUsers                        ResourceType                  `yaml:"IAMUsers"`
	KMSCustomerKeys                 KMSCustomerKeyResourceType    `yaml:"KMSCustomerKeys"`
	KinesisStream                   ResourceType                  `yaml:"KinesisStream"`
	KinesisFirehose                 ResourceType                  `yaml:"KinesisFirehose"`
	LambdaFunction                  ResourceType                  `yaml:"LambdaFunction"`
	LambdaLayer                     ResourceType                  `yaml:"LambdaLayer"`
	LaunchConfiguration             ResourceType                  `yaml:"LaunchConfiguration"`
	LaunchTemplate                  ResourceType                  `yaml:"LaunchTemplate"`
	MacieMember                     ResourceType                  `yaml:"MacieMember"`
	MSKCluster                      ResourceType                  `yaml:"MSKCluster"`
	NatGateway                      ResourceType                  `yaml:"NatGateway"`
	OIDCProvider                    ResourceType                  `yaml:"OIDCProvider"`
	OpenSearchDomain                ResourceType                  `yaml:"OpenSearchDomain"`
	Redshift                        ResourceType                  `yaml:"Redshift"`
	RdsSnapshot                     ResourceType                  `yaml:"RdsSnapshot"`
	RdsParameterGroup               ResourceType                  `yaml:"RdsParameterGroup"`
	RdsProxy                        ResourceType                  `yaml:"RdsProxy"`
	S3                              ResourceType                  `yaml:"s3"`
	S3AccessPoint                   ResourceType                  `yaml:"S3AccessPoint"`
	S3ObjectLambdaAccessPoint       ResourceType                  `yaml:"S3ObjectLambdaAccessPoint"`
	S3MultiRegionAccessPoint        ResourceType                  `yaml:"S3MultiRegionAccessPoint"`
	SESIdentity                     ResourceType                  `yaml:"SesIdentity"`
	SESConfigurationSet             ResourceType                  `yaml:"SesConfigurationset"`
	SESReceiptRuleSet               ResourceType                  `yaml:"SesReceiptRuleSet"`
	SESReceiptFilter                ResourceType                  `yaml:"SesReceiptFilter"`
	SESEmailTemplates               ResourceType                  `yaml:"SesEmailTemplates"`
	SNS                             ResourceType                  `yaml:"SNS"`
	SQS                             ResourceType                  `yaml:"SQS"`
	SageMakerEndpoint               ResourceType                  `yaml:"SageMakerEndpoint"`
	SageMakerEndpointConfig         ResourceType                  `yaml:"SageMakerEndpointConfig"`
	SageMakerNotebook               ResourceType                  `yaml:"SageMakerNotebook"`
	SageMakerStudioDomain           ResourceType                  `yaml:"SageMakerStudioDomain"`
	SecretsManagerSecrets           ResourceType                  `yaml:"SecretsManager"`
	SecurityHub                     ResourceType                  `yaml:"SecurityHub"`
	Snapshots                       ResourceType                  `yaml:"Snapshots"`
	TransitGateway                  ResourceType                  `yaml:"TransitGateway"`
	TransitGatewayRouteTable        ResourceType                  `yaml:"TransitGatewayRouteTable"`
	TransitGatewaysVpcAttachment    ResourceType                  `yaml:"TransitGatewaysVpcAttachment"`
	TransitGatewayPeeringAttachment ResourceType                  `yaml:"TransitGatewayPeeringAttachment"`
	VPC                             EC2ResourceType               `yaml:"VPC"`
	Route53HostedZone               ResourceType                  `yaml:"Route53HostedZone"`
	Route53CIDRCollection           ResourceType                  `yaml:"Route53CIDRCollection"`
	Route53TrafficPolicy            ResourceType                  `yaml:"Route53TrafficPolicy"`
	InternetGateway                 ResourceType                  `yaml:"InternetGateway"`
	NetworkACL                      ResourceType                  `yaml:"NetworkACL"`
	NetworkInterface                ResourceType                  `yaml:"NetworkInterface"`
	SecurityGroup                   EC2ResourceType               `yaml:"SecurityGroup"`
	NetworkFirewall                 ResourceType                  `yaml:"NetworkFirewall"`
	NetworkFirewallPolicy           ResourceType                  `yaml:"NetworkFirewallPolicy"`
	NetworkFirewallRuleGroup        ResourceType                  `yaml:"NetworkFirewallRuleGroup"`
	NetworkFirewallTLSConfig        ResourceType                  `yaml:"NetworkFirewallTLSConfig"`
	NetworkFirewallResourcePolicy   ResourceType                  `yaml:"NetworkFirewallResourcePolicy"`
	VPCLatticeServiceNetwork        ResourceType                  `yaml:"VPCLatticeServiceNetwork"`
	VPCLatticeService               ResourceType                  `yaml:"VPCLatticeService"`
	VPCLatticeTargetGroup           ResourceType                  `yaml:"VPCLatticeTargetGroup"`

	// GCP Resources
	GCSBucket ResourceType `yaml:"GCSBucket"`
}

Config - the config object we pass around

func GetConfig

func GetConfig(filePath string) (*Config, error)

GetConfig - Unmarshall the config file and parse it into a config object.

func (*Config) AddEC2DefaultOnly added in v0.36.0

func (c *Config) AddEC2DefaultOnly(flag bool)

func (*Config) AddExcludeAfterTime added in v0.33.0

func (c *Config) AddExcludeAfterTime(excludeAfter *time.Time)

func (*Config) AddIncludeAfterTime added in v0.33.0

func (c *Config) AddIncludeAfterTime(includeAfter *time.Time)

func (*Config) AddProtectUntilExpireFlag added in v0.37.2

func (c *Config) AddProtectUntilExpireFlag(flag bool)

func (*Config) AddTimeout added in v0.35.0

func (c *Config) AddTimeout(timeout *time.Duration)

type EC2ResourceType added in v0.36.0

type EC2ResourceType struct {
	DefaultOnly  bool `yaml:"default_only"`
	ResourceType `yaml:",inline"`
}

type Expression added in v0.1.26

type Expression struct {
	RE regexp.Regexp
}

func (*Expression) UnmarshalText added in v0.1.26

func (expression *Expression) UnmarshalText(data []byte) error

UnmarshalText - Internally used by yaml.Unmarshal to unmarshall an Expression field

type FilterRule

type FilterRule struct {
	NamesRegExp  []Expression          `yaml:"names_regex"`
	TimeAfter    *time.Time            `yaml:"time_after"`
	TimeBefore   *time.Time            `yaml:"time_before"`
	Tag          *string               `yaml:"tag"`       // Deprecated ~ A tag to filter resources by. (e.g., If set under ExcludedRule, resources with this tag will be excluded).
	TagValue     *Expression           `yaml:"tag_value"` // Deprecated
	Tags         map[string]Expression `yaml:"tags"`
	TagsOperator string                `yaml:"tags_operator"` // "AND" or "OR" - defaults to "OR" for backward compatibility
}

type KMSCustomerKeyResourceType added in v0.33.0

type KMSCustomerKeyResourceType struct {
	IncludeUnaliasedKeys bool `yaml:"include_unaliased_keys"`
	ResourceType         `yaml:",inline"`
}

type ResourceType

type ResourceType struct {
	IncludeRule        FilterRule `yaml:"include"`
	ExcludeRule        FilterRule `yaml:"exclude"`
	Timeout            string     `yaml:"timeout"`
	ProtectUntilExpire bool       `yaml:"protect_until_expire"`
}

func (ResourceType) ShouldInclude added in v0.33.0

func (r ResourceType) ShouldInclude(value ResourceValue) bool

func (ResourceType) ShouldIncludeBasedOnTag added in v0.33.0

func (r ResourceType) ShouldIncludeBasedOnTag(tags map[string]string) bool

func (ResourceType) ShouldIncludeBasedOnTime added in v0.33.0

func (r ResourceType) ShouldIncludeBasedOnTime(time time.Time) bool

type ResourceValue added in v0.33.0

type ResourceValue struct {
	Name *string
	Time *time.Time
	Tags map[string]string
}

Jump to

Keyboard shortcuts

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