Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertACMPCATagsToMap(tags []acmpcatypes.Tag) map[string]string
- func ConvertACMTagsToMap(tags []acmtypes.Tag) map[string]string
- func ConvertAppRunnerTagsToMap(tags []apprunnertypes.Tag) map[string]string
- func ConvertAutoScalingTagsToMap(tags []autoscaling.TagDescription) map[string]string
- func ConvertCloudFormationTagsToMap(tags []cloudformationtypes.Tag) map[string]string
- func ConvertCloudFrontTagsToMap(tags []cloudfronttypes.Tag) map[string]string
- func ConvertCloudWatchTagsToMap(tags []cloudwatchtypes.Tag) map[string]string
- func ConvertCodeDeployTagsToMap(tags []codedeploytypes.Tag) map[string]string
- func ConvertConfigServiceTagsToMap(tags []configservicetypes.Tag) map[string]string
- func ConvertDataPipelineTagsToMap(tags []datapipelinetypes.Tag) map[string]string
- func ConvertDataSyncTagsToMap(tags []datasynctypes.TagListEntry) map[string]string
- func ConvertDynamoDBTagsToMap(tags []dynamodbtypes.Tag) map[string]string
- func ConvertECRTagsToMap(tags []ecrtypes.Tag) map[string]string
- func ConvertEFSTagsToMap(tags []efstypes.Tag) map[string]string
- func ConvertElastiCacheTagsToMap(tags []elasticachetypes.Tag) map[string]string
- func ConvertElasticBeanstalkTagsToMap(tags []ebtypes.Tag) map[string]string
- func ConvertEventBridgeTagsToMap(tags []eventbridgetypes.Tag) map[string]string
- func ConvertFirehoseTagsToMap(tags []firehosetypes.Tag) map[string]string
- func ConvertIAMTagsToMap(tags []iam.Tag) map[string]string
- func ConvertKinesisTagsToMap(tags []kinesistypes.Tag) map[string]string
- func ConvertNetworkFirewallTagsToMap(tags []networkfirewalltypes.Tag) map[string]string
- func ConvertOpenSearchTagsToMap(tags []opensearchtypes.Tag) map[string]string
- func ConvertRDSTypeTagsToMap(tags []rdstypes.Tag) map[string]string
- func ConvertRedshiftTagsToMap(tags []redshifttypes.Tag) map[string]string
- func ConvertRoute53TagsToMap(tags []route53types.Tag) map[string]string
- func ConvertS3TypesTagsToMap(tags []s3types.Tag) map[string]string
- func ConvertSNSTagsToMap(tags []snstypes.Tag) map[string]string
- func ConvertSageMakerTagsToMap(tags []sagemakertypes.Tag) map[string]string
- func ConvertSchedulerTagsToMap(tags []schedulertypes.Tag) map[string]string
- func ConvertSecretsManagerTagsToMap(tags []secretsmanagertypes.Tag) map[string]string
- func ConvertStringPtrTagsToMap(tags map[string]*string) map[string]string
- func ConvertTypesTagsToMap(tags []ec2types.Tag) map[string]string
- func DerefString(p *string) string
- func DerefStringSlice(ps []*string) []string
- func Difference(a, b []*string) []*string
- func FormatTimestamp(timestamp time.Time) string
- func GetBoolFromContext(ctx context.Context, key ContextKey) (bool, error)
- func GetCurrentAccountId(config aws.Config) (string, error)
- func GetEC2ResourceNameTagValue(tags []ec2types.Tag) *string
- func GetOrCreateFirstSeen(ctx context.Context, client interface{}, identifier *string, ...) (*time.Time, error)
- func IsFirstSeenTag(key *string) bool
- func IsThrottlingError(err error) bool
- func IsWarningError(err error) bool
- func ParseTimestamp(timestamp *string) (*time.Time, error)
- func PollUntil(ctx context.Context, description string, interval, timeout time.Duration, ...) error
- func RemoveNewlines(s string) string
- func Split(identifiers []string, limit int) [][]string
- func ToStringPtrSlice(strs []string) []*string
- func TransformAWSError(err error) error
- func Truncate(s string, maxLen int) string
- func UniqueID() string
- type ContextKey
- type ResourceExecutionTimeout
Constants ¶
const AWSAccessDeniedException string = "AccessDeniedException"
const AwsDryRunSuccess string = "Request would have succeeded, but DryRun flag is set."
const ( // FirstSeenTagKey A tag used to set custom AWS Tags to resources that do not support `created at` timestamp> - EIP & ECS Clusters. // This is used in relation to the `--older-than <duration>` filtering that `cloud-nuke` allows. // Due to its destructive nature, `cloud-nuke` has been configured not to delete AWS resources without known creation time, // and instead tag them with the `firstSeenTagKey`. // The next time `cloud-nuke aws --older-than <duration>` is run, it will use the tag to determine if the AWS resource should be deleted or not. FirstSeenTagKey = "cloud-nuke-first-seen" )
Variables ¶
var ErrContextExecutionTimeout = errors.New("error:EXECUTION_TIMEOUT")
var ErrDeleteProtectionEnabled = errors.New("error:DeleteProtectionEnabled")
var ErrDifferentOwner = errors.New("error:DIFFERENT_OWNER")
var ErrInSufficientPermission = errors.New("error:INSUFFICIENT_PERMISSION")
var ErrInterfaceIDNotFound = errors.New("error:InterfaceIdNotFound")
var ErrInvalidGroupNotFound = errors.New("error:InvalidGroup.NotFound")
var ErrInvalidPermisionNotFound = errors.New("error:InvalidPermission.NotFound")
var ErrInvalidSnapshotNotFound = errors.New("error:InvalidSnapshot.NotFound")
var ErrResourceNotFoundException = errors.New("error:ErrResourceNotFoundException")
Functions ¶
func ConvertACMPCATagsToMap ¶ added in v0.49.0
func ConvertACMPCATagsToMap(tags []acmpcatypes.Tag) map[string]string
func ConvertACMTagsToMap ¶ added in v0.49.0
func ConvertAppRunnerTagsToMap ¶ added in v0.49.0
func ConvertAppRunnerTagsToMap(tags []apprunnertypes.Tag) map[string]string
func ConvertAutoScalingTagsToMap ¶ added in v0.33.0
func ConvertAutoScalingTagsToMap(tags []autoscaling.TagDescription) map[string]string
func ConvertCloudFormationTagsToMap ¶ added in v0.43.0
func ConvertCloudFormationTagsToMap(tags []cloudformationtypes.Tag) map[string]string
func ConvertCloudFrontTagsToMap ¶ added in v0.49.0
func ConvertCloudFrontTagsToMap(tags []cloudfronttypes.Tag) map[string]string
func ConvertCloudWatchTagsToMap ¶ added in v0.49.0
func ConvertCloudWatchTagsToMap(tags []cloudwatchtypes.Tag) map[string]string
func ConvertCodeDeployTagsToMap ¶ added in v0.49.0
func ConvertCodeDeployTagsToMap(tags []codedeploytypes.Tag) map[string]string
func ConvertConfigServiceTagsToMap ¶ added in v0.49.0
func ConvertConfigServiceTagsToMap(tags []configservicetypes.Tag) map[string]string
func ConvertDataPipelineTagsToMap ¶ added in v0.49.0
func ConvertDataPipelineTagsToMap(tags []datapipelinetypes.Tag) map[string]string
func ConvertDataSyncTagsToMap ¶ added in v0.49.0
func ConvertDataSyncTagsToMap(tags []datasynctypes.TagListEntry) map[string]string
func ConvertDynamoDBTagsToMap ¶ added in v0.49.0
func ConvertDynamoDBTagsToMap(tags []dynamodbtypes.Tag) map[string]string
func ConvertECRTagsToMap ¶ added in v0.49.0
func ConvertEFSTagsToMap ¶ added in v0.47.0
func ConvertElastiCacheTagsToMap ¶ added in v0.49.0
func ConvertElastiCacheTagsToMap(tags []elasticachetypes.Tag) map[string]string
func ConvertElasticBeanstalkTagsToMap ¶ added in v0.49.0
func ConvertEventBridgeTagsToMap ¶ added in v0.49.0
func ConvertEventBridgeTagsToMap(tags []eventbridgetypes.Tag) map[string]string
func ConvertFirehoseTagsToMap ¶ added in v0.49.0
func ConvertFirehoseTagsToMap(tags []firehosetypes.Tag) map[string]string
func ConvertIAMTagsToMap ¶ added in v0.33.0
func ConvertKinesisTagsToMap ¶ added in v0.49.0
func ConvertKinesisTagsToMap(tags []kinesistypes.Tag) map[string]string
func ConvertNetworkFirewallTagsToMap ¶ added in v0.36.0
func ConvertNetworkFirewallTagsToMap(tags []networkfirewalltypes.Tag) map[string]string
func ConvertOpenSearchTagsToMap ¶ added in v0.47.0
func ConvertOpenSearchTagsToMap(tags []opensearchtypes.Tag) map[string]string
func ConvertRDSTypeTagsToMap ¶ added in v0.38.0
func ConvertRedshiftTagsToMap ¶ added in v0.47.0
func ConvertRedshiftTagsToMap(tags []redshifttypes.Tag) map[string]string
func ConvertRoute53TagsToMap ¶ added in v0.42.0
func ConvertRoute53TagsToMap(tags []route53types.Tag) map[string]string
func ConvertS3TypesTagsToMap ¶ added in v0.38.0
func ConvertSNSTagsToMap ¶ added in v0.49.0
func ConvertSageMakerTagsToMap ¶ added in v0.41.0
func ConvertSageMakerTagsToMap(tags []sagemakertypes.Tag) map[string]string
ConvertSageMakerTagsToMap converts SageMaker tags to a map[string]string
func ConvertSchedulerTagsToMap ¶ added in v0.49.0
func ConvertSchedulerTagsToMap(tags []schedulertypes.Tag) map[string]string
func ConvertSecretsManagerTagsToMap ¶ added in v0.43.0
func ConvertSecretsManagerTagsToMap(tags []secretsmanagertypes.Tag) map[string]string
func ConvertStringPtrTagsToMap ¶ added in v0.33.0
func ConvertTypesTagsToMap ¶ added in v0.38.0
func DerefString ¶ added in v0.47.0
DerefString safely dereferences a string pointer, returning "" for nil.
func DerefStringSlice ¶ added in v0.47.0
DerefStringSlice dereferences a slice of string pointers to a slice of strings.
func Difference ¶ added in v0.33.0
Difference returns the elements in `a` that aren't in `b`.
func FormatTimestamp ¶ added in v0.33.0
func GetBoolFromContext ¶ added in v0.36.0
func GetBoolFromContext(ctx context.Context, key ContextKey) (bool, error)
func GetCurrentAccountId ¶ added in v0.13.0
func GetEC2ResourceNameTagValue ¶ added in v0.34.0
func GetOrCreateFirstSeen ¶ added in v0.36.0
func IsFirstSeenTag ¶ added in v0.33.0
func IsThrottlingError ¶ added in v0.47.0
IsThrottlingError checks if the error is an AWS API throttling error using structured error code matching via smithy.APIError.
func IsWarningError ¶ added in v0.47.0
IsWarningError checks if the error is a transient/expected failure that should be logged as a warning rather than causing a non-zero exit code. These errors fall into three categories:
Ordering/dependency errors — resources deleted in the wrong order. The dependent resource will be cleaned up on the next nuke run once the parent is gone:
- DependencyViolation: EC2 subnet/ENI/SG still referenced by another resource
- InvalidDBSubnetGroupStateFault: RDS subnet group in use by a DB instance
- InvalidDBClusterStateFault: RDS cluster can't be deleted while its instances exist
- InvalidDBClusterSnapshotStateFault: RDS cluster snapshot is not in available/failed state
- InvalidClusterState: Redshift cluster has an operation in progress
- InvalidHomeRegionException: CloudTrail trail can only be deleted from its home region
- CacheSubnetGroupInUse: ElastiCache subnet group still used by a cache cluster
- InvalidDBSnapshotState: RDS automated snapshot cannot be manually deleted
- InvalidCacheClusterState: ElastiCache cluster is mid-transition (creating/modifying) and can't be deleted yet
- InvalidDBParameterGroupState: RDS parameter group still referenced by a DB instance
Already-deleted errors — resource was deleted between the scan and nuke phases (e.g., by another concurrent nuke run or TTL expiry). Safe to ignore. Matched by any error code containing "NotFound" (case-insensitive).
SCP-denied errors — the organization's service control policy permanently forbids the action; retrying or fixing IAM permissions will not help:
- AccessDeniedException with "explicit deny in a service control policy"
Waiter timeout errors — the deletion was initiated but the AWS SDK waiter timed out before the resource fully disappeared. The resource is still being deleted and will be cleaned up on the next nuke run:
- "exceeded max wait time" from AWS SDK v2 waiters
func PollUntil ¶ added in v0.47.0
func PollUntil(ctx context.Context, description string, interval, timeout time.Duration, condition func(ctx context.Context) (bool, error)) error
PollUntil repeatedly calls condition until it returns true, the timeout elapses, or the context is cancelled. The condition is checked immediately on the first iteration (before any sleep). This is useful for waiting on async AWS operations that lack a built-in SDK waiter (e.g., VPN gateway detachment).
The interval is the delay between condition checks. The caller must ensure interval > 0 to avoid a hot spin loop.
func RemoveNewlines ¶ added in v0.34.0
RemoveNewlines will delete all the newlines in a given string, which is useful for making error messages "sit" more nicely within their specified table cells in the terminal
func ToStringPtrSlice ¶ added in v0.47.0
ToStringPtrSlice converts a slice of strings to a slice of string pointers.
func TransformAWSError ¶ added in v0.34.0
TransformAWSError this function is used to handle AWS errors and mapping them to a custom error message This could be part of a larger error-handling strategy that interacts with AWS services, providing a more human-readable error message for certain conditions ref : https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html
func Truncate ¶ added in v0.34.0
Truncate accepts a string and a max length. If the max length is less than the string's current length, then only the first maxLen characters of the string are returned
func UniqueID ¶
func UniqueID() string
Returns a unique (ish) id we can attach to resources and tfstate files so they don't conflict with each other Uses base 62 to generate a 6 character string that's unlikely to collide with the handful of tests we run in parallel. Based on code here: http://stackoverflow.com/a/9543797/483528
Types ¶
type ContextKey ¶ added in v0.46.0
type ContextKey string
ContextKey is a custom type to avoid collisions when using context.WithValue
const AccountIdKey ContextKey = "accountId"
AccountIdKey is the context key used to store the AWS account ID.
const (
ExcludeFirstSeenTagKey ContextKey = "exclude-first-seen-tag"
)
type ResourceExecutionTimeout ¶ added in v0.35.0
func (ResourceExecutionTimeout) Error ¶ added in v0.35.0
func (err ResourceExecutionTimeout) Error() string