config

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 7 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 AWSProtectableResourceType added in v0.47.0

type AWSProtectableResourceType struct {
	ResourceType `yaml:",inline"`
}

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"`
	DataPipeline                    ResourceType               `yaml:"DataPipeline"`
	DataSyncLocation                ResourceType               `yaml:"DataSyncLocation"`
	DataSyncTask                    ResourceType               `yaml:"DataSyncTask"`
	DBGlobalClusters                ResourceType               `yaml:"DBGlobalClusters"`
	DBClusters                      AWSProtectableResourceType `yaml:"DBClusters"`
	DBInstances                     AWSProtectableResourceType `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"`
	EC2IPAMByoasn                   ResourceType               `yaml:"EC2IPAMByoasn"`
	EC2IPAMCustomAllocation         ResourceType               `yaml:"EC2IPAMCustomAllocation"`
	EC2IPAMPool                     ResourceType               `yaml:"EC2IPAMPool"`
	EC2IPAMResourceDiscovery        ResourceType               `yaml:"EC2IPAMResourceDiscovery"`
	EC2IPAMScope                    ResourceType               `yaml:"EC2IPAMScope"`
	EC2Endpoint                     EC2ResourceType            `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"`
	ElastiCacheParameterGroup       ResourceType               `yaml:"ElastiCacheParameterGroup"`
	ElastiCacheServerless           ResourceType               `yaml:"ElastiCacheServerless"`
	ElastiCacheSubnetGroup          ResourceType               `yaml:"ElastiCacheSubnetGroup"`
	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                      EC2ResourceType            `yaml:"NATGateway"`
	OIDCProvider                    ResourceType               `yaml:"OIDCProvider"`
	OpenSearchDomain                ResourceType               `yaml:"OpenSearchDomain"`
	Redshift                        ResourceType               `yaml:"Redshift"`
	RedshiftSnapshotCopyGrant       ResourceType               `yaml:"RedshiftSnapshotCopyGrant"`
	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"`
	SecretsManager                  ResourceType               `yaml:"SecretsManager"`
	SSMParameter                    ResourceType               `yaml:"SSMParameter"`
	SecurityHub                     ResourceType               `yaml:"SecurityHub"`
	Snapshots                       ResourceType               `yaml:"Snapshots"`
	TransitGateway                  ResourceType               `yaml:"TransitGateway"`
	TransitGatewayRouteTable        ResourceType               `yaml:"TransitGatewayRouteTable"`
	TransitGatewayVPCAttachment     ResourceType               `yaml:"TransitGatewayVPCAttachment"`
	TransitGatewayPeeringAttachment ResourceType               `yaml:"TransitGatewayPeeringAttachment"`
	VPC                             EC2ResourceType            `yaml:"VPC"`
	Route53HostedZone               ResourceType               `yaml:"Route53HostedZone"`
	Route53CIDRCollection           ResourceType               `yaml:"Route53CIDRCollection"`
	Route53TrafficPolicy            ResourceType               `yaml:"Route53TrafficPolicy"`
	InternetGateway                 EC2ResourceType            `yaml:"InternetGateway"`
	NetworkACL                      ResourceType               `yaml:"NetworkACL"`
	NetworkInterface                EC2ResourceType            `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"`
	RouteTable                      EC2ResourceType            `yaml:"RouteTable"`
	VPCPeeringConnection            ResourceType               `yaml:"VPCPeeringConnection"`

	// GCP Resources
	GCSBucket        ResourceType `yaml:"GCSBucket"`
	CloudFunction    ResourceType `yaml:"CloudFunction"`
	ArtifactRegistry ResourceType `yaml:"ArtifactRegistry"`
	GcpPubSubTopic   ResourceType `yaml:"GcpPubSubTopic"`
}

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) AddIncludeTags added in v0.47.0

func (c *Config) AddIncludeTags(tags map[string]Expression)

AddIncludeTags applies global tag include filters to all resource types. This merges CLI-provided tags with any existing per-resource-type include tags from the config file, with config file tags taking precedence on conflicts.

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)

func (*Config) ApplyTimeFilters added in v0.46.0

func (c *Config) ApplyTimeFilters(excludeAfter, includeAfter *time.Time)

ApplyTimeFilters applies time-based filters to the config

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"`
	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