dynamodb

package
v0.68.10 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 12 Imported by: 9

Documentation

Overview

Package dynamodb provides utilities for working with DynamoDB tables, such as creating and deleting tables.

Index

Constants

View Source
const AttrLockID = "LockID"

AttrLockID is the name of the primary key for the lock table in DynamoDB. OpenTofu/Terraform requires the DynamoDB table to have a primary key with this name

View Source
const DynamodbPayPerRequestBillingMode = "PAY_PER_REQUEST"

DynamodbPayPerRequestBillingMode is the billing mode for DynamoDB tables that allows for pay-per-request billing instead of provisioned capacity.

View Source
const MaxRetriesWaitingForTableToBeActive = 30

MaxRetriesWaitingForTableToBeActive is the maximum number of times we will retry waiting for a table to be active.

Default is to retry for up to 5 minutes

View Source
const SleepBetweenTableStatusChecks = 10 * time.Second

SleepBetweenTableStatusChecks is the amount of time we will sleep between checks to see if a table is active.

Variables

This section is empty.

Functions

func CreateDynamoDBClient added in v0.67.7

func CreateDynamoDBClient(config *awshelper.AwsSessionConfig, terragruntOptions *options.TerragruntOptions) (*dynamodb.DynamoDB, error)

CreateDynamoDBClient creates an authenticated client for DynamoDB.

func CreateLockTable added in v0.12.0

func CreateLockTable(tableName string, tags map[string]string, client *dynamodb.DynamoDB, terragruntOptions *options.TerragruntOptions) error

CreateLockTable creates a lock table in DynamoDB and wait until it is in "active" state. If the table already exists, merely wait until it is in "active" state.

func CreateLockTableIfNecessary added in v0.12.0

func CreateLockTableIfNecessary(tableName string, tags map[string]string, client *dynamodb.DynamoDB, terragruntOptions *options.TerragruntOptions) error

CreateLockTableIfNecessary creates the lock table in DynamoDB if it doesn't already exist.

func DeleteTable added in v0.12.0

func DeleteTable(tableName string, dbClient *dynamodb.DynamoDB) error

DeleteTable deletes the given table in DynamoDB.

func LockTableCheckSSEncryptionIsOn added in v0.18.0

func LockTableCheckSSEncryptionIsOn(tableName string, client *dynamodb.DynamoDB) (bool, error)

LockTableCheckSSEncryptionIsOn returns true if the lock table's SSEncryption is turned on

func LockTableExistsAndIsActive added in v0.13.6

func LockTableExistsAndIsActive(tableName string, client *dynamodb.DynamoDB) (bool, error)

LockTableExistsAndIsActive returns true if the lock table exists in DynamoDB and is in "active" state.

func UpdateLockTableSetSSEncryptionOnIfNecessary added in v0.18.0

func UpdateLockTableSetSSEncryptionOnIfNecessary(tableName string, client *dynamodb.DynamoDB, terragruntOptions *options.TerragruntOptions) error

UpdateLockTableSetSSEncryptionOnIfNecessary encrypts the TFState Lock table - If Necessary

func WaitForTableToBeActiveWithRandomSleep added in v0.66.7

func WaitForTableToBeActiveWithRandomSleep(tableName string, client *dynamodb.DynamoDB, maxRetries int, sleepBetweenRetriesMin time.Duration, sleepBetweenRetriesMax time.Duration, terragruntOptions *options.TerragruntOptions) error

WaitForTableToBeActiveWithRandomSleep waits for the given table as described above, but sleeps a random amount of time greater than sleepBetweenRetriesMin and less than sleepBetweenRetriesMax between tries. This is to avoid an AWS issue where all waiting requests fire at the same time, which continually triggered AWS's "subscriber limit exceeded" API error.

Types

type CountingSemaphore added in v0.12.0

type CountingSemaphore chan empty

func NewCountingSemaphore added in v0.12.0

func NewCountingSemaphore(size int) CountingSemaphore

NewCountingSemaphore is a bare-bones counting semaphore implementation based on: http://www.golangpatterns.info/concurrency/semaphores

func (CountingSemaphore) Acquire added in v0.12.0

func (semaphore CountingSemaphore) Acquire()

func (CountingSemaphore) Release added in v0.12.0

func (semaphore CountingSemaphore) Release()

type DeleteTableRetryer added in v0.63.3

type DeleteTableRetryer struct {
	client.DefaultRetryer
}

func (DeleteTableRetryer) ShouldRetry added in v0.63.3

func (retryer DeleteTableRetryer) ShouldRetry(req *request.Request) bool

type TableActiveRetriesExceeded

type TableActiveRetriesExceeded struct {
	TableName string
	Retries   int
}

func (TableActiveRetriesExceeded) Error

func (err TableActiveRetriesExceeded) Error() string

type TableDoesNotExist added in v0.12.0

type TableDoesNotExist struct {
	TableName  string
	Underlying error
}

func (TableDoesNotExist) Error added in v0.12.0

func (err TableDoesNotExist) Error() string

type TableEncryptedRetriesExceeded added in v0.18.0

type TableEncryptedRetriesExceeded struct {
	TableName string
	Retries   int
}

func (TableEncryptedRetriesExceeded) Error added in v0.18.0

Jump to

Keyboard shortcuts

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