aws

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package aws implements AWS-specific cluster destroy cleanup for the clusterdelete package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	ClusterID    string
	Bucket       string
	Region       string
	Profile      string
	ShardConfigs map[string]ShardOutput
	WaitTimeout  time.Duration
	PollInterval time.Duration
}

Options contains AWS cleanup settings parsed from config and Terraform outputs.

func ParseOptions

func ParseOptions(cfg *clusterconfig.ClusterConfig, outputs []byte) (*Options, error)

ParseOptions extracts AWS cleanup settings from cluster config and OpenTofu/Terraform output JSON.

type Provider

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

Provider performs AWS-specific cluster delete cleanup.

func New

func New(ctx context.Context, provider clusterconfig.Provider) (*Provider, error)

New creates an AWS delete provider using the region and profile from the cluster provider config.

func (*Provider) ClusterID

func (p *Provider) ClusterID() string

ClusterID returns the configured cluster ID for status messages and AWS tag filters.

func (*Provider) ListTaggedInstances

func (p *Provider) ListTaggedInstances(ctx context.Context, managedOnly bool) ([]clusterdelete.Instance, error)

ListTaggedInstances lists EC2 instances tagged for the cluster, optionally limited to Nstance-managed instances.

func (*Provider) Prepare

func (p *Provider) Prepare(ctx context.Context, cfg *clusterconfig.ClusterConfig, outputs []byte) error

Prepare parses Terraform outputs and stores the AWS cleanup options needed by subsequent provider operations.

func (*Provider) RemainingManagedInstances

func (p *Provider) RemainingManagedInstances(ctx context.Context) ([]clusterdelete.Instance, error)

RemainingManagedInstances lists Nstance-managed EC2 instances still present after scale-down.

func (*Provider) ScaleManagedGroupsToZero

func (p *Provider) ScaleManagedGroupsToZero(ctx context.Context) error

ScaleManagedGroupsToZero updates each shard config in S3 so managed groups scale down before infrastructure destroy.

func (*Provider) TerminateInstances

func (p *Provider) TerminateInstances(ctx context.Context, instances []clusterdelete.Instance) error

TerminateInstances directly terminates the supplied EC2 instances.

func (*Provider) WaitForManagedInstancesGone

func (p *Provider) WaitForManagedInstancesGone(ctx context.Context) error

WaitForManagedInstancesGone polls AWS until no Nstance-managed EC2 instances remain for the cluster.

type ShardOutput

type ShardOutput struct {
	ConfigKey string   `json:"config_key"`
	ServerIPs []string `json:"server_ips"`
}

ShardOutput contains Terraform output metadata for one Nstance shard.

type TFOutput

type TFOutput struct {
	Sensitive bool            `json:"sensitive"`
	Type      json.RawMessage `json:"type"`
	Value     json.RawMessage `json:"value"`
}

TFOutput represents one OpenTofu/Terraform JSON output entry.

Jump to

Keyboard shortcuts

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