Documentation ¶
Index ¶
- Constants
- Variables
- func CreateS3Bucket(s3Client *s3.S3, config *RemoteStateConfigS3, ...) error
- func CreateS3BucketWithVersioningSSEncryptionAndAccessLogging(s3Client *s3.S3, config *ExtendedRemoteStateConfigS3, ...) error
- func CreateS3Client(config *aws_helper.AwsSessionConfig, ...) (*s3.S3, error)
- func DoesS3BucketExist(s3Client *s3.S3, config *RemoteStateConfigS3) bool
- func EnableAccessLoggingForS3BucketWide(s3Client *s3.S3, config *RemoteStateConfigS3, ...) error
- func EnableSSEForS3BucketWide(s3Client *s3.S3, config *RemoteStateConfigS3, ...) error
- func EnableVersioningForS3Bucket(s3Client *s3.S3, config *RemoteStateConfigS3, ...) error
- func TagS3Bucket(s3Client *s3.S3, config *ExtendedRemoteStateConfigS3, ...) error
- func UpdateLockTableSetSSEncryptionOnIfNecessary(s3Config *RemoteStateConfigS3, config *ExtendedRemoteStateConfigS3, ...) error
- func WaitUntilS3BucketExists(s3Client *s3.S3, config *RemoteStateConfigS3, ...) error
- type CantParseTerraformStateFile
- type ExtendedRemoteStateConfigS3
- type MaxRetriesWaitingForS3ACLExceeded
- type MaxRetriesWaitingForS3BucketExceeded
- type MissingRequiredS3RemoteStateConfig
- type MultipleTagsDeclarations
- type RemoteState
- func (remoteState *RemoteState) FillDefaults()
- func (remoteState *RemoteState) Initialize(terragruntOptions *options.TerragruntOptions) error
- func (remoteState *RemoteState) NeedsInit(terragruntOptions *options.TerragruntOptions) (bool, error)
- func (remoteState *RemoteState) String() string
- func (remoteState RemoteState) ToTerraformInitArgs() []string
- func (remoteState *RemoteState) Validate() error
- type RemoteStateConfigS3
- type RemoteStateInitializer
- type S3Initializer
- func (s3Initializer S3Initializer) GetTerraformInitArgs(config map[string]interface{}) map[string]interface{}
- func (s3Initializer S3Initializer) Initialize(config map[string]interface{}, terragruntOptions *options.TerragruntOptions) error
- func (s3Initializer S3Initializer) NeedsInitialization(config map[string]interface{}, existingBackend *TerraformBackend, ...) (bool, error)
- type TerraformBackend
- type TerraformState
- type TerraformStateModule
Constants ¶
const DEFAULT_PATH_TO_LOCAL_STATE_FILE = "terraform.tfstate"
When storing Terraform state locally, this is the default path to the tfstate file
const DEFAULT_PATH_TO_REMOTE_STATE_FILE = ".terraform/terraform.tfstate"
When using remote state storage, Terraform keeps a local copy of the state file in this folder
const MAX_RETRIES_WAITING_FOR_S3_BUCKET = 12
const SLEEP_BETWEEN_RETRIES_WAITING_FOR_S3_BUCKET = 5 * time.Second
Variables ¶
var RemoteBackendMissing = fmt.Errorf("The remote_state.backend field cannot be empty")
Functions ¶
func CreateS3Bucket ¶ added in v0.2.0
func CreateS3Bucket(s3Client *s3.S3, config *RemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Create the S3 bucket specified in the given config
func CreateS3BucketWithVersioningSSEncryptionAndAccessLogging ¶ added in v0.18.0
func CreateS3BucketWithVersioningSSEncryptionAndAccessLogging(s3Client *s3.S3, config *ExtendedRemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Create the given S3 bucket and enable versioning for it
func CreateS3Client ¶ added in v0.2.0
func CreateS3Client(config *aws_helper.AwsSessionConfig, terragruntOptions *options.TerragruntOptions) (*s3.S3, error)
Create an authenticated client for DynamoDB
func DoesS3BucketExist ¶ added in v0.2.0
func DoesS3BucketExist(s3Client *s3.S3, config *RemoteStateConfigS3) bool
Returns true if the S3 bucket specified in the given config exists and the current user has the ability to access it.
func EnableAccessLoggingForS3BucketWide ¶ added in v0.18.0
func EnableAccessLoggingForS3BucketWide(s3Client *s3.S3, config *RemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Enable bucket-wide Access Logging for the AWS S3 bucket specified in the given config
func EnableSSEForS3BucketWide ¶ added in v0.18.0
func EnableSSEForS3BucketWide(s3Client *s3.S3, config *RemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Enable bucket-wide Server-Side Encryption for the AWS S3 bucket specified in the given config
func EnableVersioningForS3Bucket ¶ added in v0.2.0
func EnableVersioningForS3Bucket(s3Client *s3.S3, config *RemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Enable versioning for the S3 bucket specified in the given config
func TagS3Bucket ¶ added in v0.14.11
func TagS3Bucket(s3Client *s3.S3, config *ExtendedRemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
func UpdateLockTableSetSSEncryptionOnIfNecessary ¶ added in v0.18.0
func UpdateLockTableSetSSEncryptionOnIfNecessary(s3Config *RemoteStateConfigS3, config *ExtendedRemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
Update a table for locks in DynamoDB if the user has configured a lock table and the table's server-side encryption isn't turned on
func WaitUntilS3BucketExists ¶ added in v0.4.0
func WaitUntilS3BucketExists(s3Client *s3.S3, config *RemoteStateConfigS3, terragruntOptions *options.TerragruntOptions) error
AWS is eventually consistent, so after creating an S3 bucket, this method can be used to wait until the information about that S3 bucket has propagated everywhere
Types ¶
type CantParseTerraformStateFile ¶
func (CantParseTerraformStateFile) Error ¶
func (err CantParseTerraformStateFile) Error() string
type ExtendedRemoteStateConfigS3 ¶ added in v0.14.11
type ExtendedRemoteStateConfigS3 struct { S3BucketTags map[string]string `mapstructure:"s3_bucket_tags"` DynamotableTags map[string]string `mapstructure:"dynamodb_table_tags"` SkipBucketVersioning bool `mapstructure:"skip_bucket_versioning"` SkipBucketSSEncryption bool `mapstructure:"skip_bucket_ssencryption"` SkipBucketAccessLogging bool `mapstructure:"skip_bucket_accesslogging"` EnableLockTableSSEncryption bool `mapstructure:"enable_lock_table_ssencryption"` // contains filtered or unexported fields }
* We use this construct to separate the two config keys 's3_bucket_tags' and 'dynamodb_table_tags' * from the others, as they are specific to the s3 backend, but only used by terragrunt to tag * the s3 bucket and the dynamo db, in case it has to create them.
type MaxRetriesWaitingForS3ACLExceeded ¶ added in v0.18.0
type MaxRetriesWaitingForS3ACLExceeded string
func (MaxRetriesWaitingForS3ACLExceeded) Error ¶ added in v0.18.0
func (err MaxRetriesWaitingForS3ACLExceeded) Error() string
type MaxRetriesWaitingForS3BucketExceeded ¶ added in v0.4.0
type MaxRetriesWaitingForS3BucketExceeded string
func (MaxRetriesWaitingForS3BucketExceeded) Error ¶ added in v0.4.0
func (err MaxRetriesWaitingForS3BucketExceeded) Error() string
type MissingRequiredS3RemoteStateConfig ¶ added in v0.2.0
type MissingRequiredS3RemoteStateConfig string
func (MissingRequiredS3RemoteStateConfig) Error ¶ added in v0.2.0
func (configName MissingRequiredS3RemoteStateConfig) Error() string
type MultipleTagsDeclarations ¶ added in v0.14.11
type MultipleTagsDeclarations string
func (MultipleTagsDeclarations) Error ¶ added in v0.14.11
func (target MultipleTagsDeclarations) Error() string
type RemoteState ¶
Configuration for Terraform remote state
func (*RemoteState) FillDefaults ¶
func (remoteState *RemoteState) FillDefaults()
Fill in any default configuration for remote state
func (*RemoteState) Initialize ¶ added in v0.2.0
func (remoteState *RemoteState) Initialize(terragruntOptions *options.TerragruntOptions) error
Perform any actions necessary to initialize the remote state before it's used for storage. For example, if you're using S3 for remote state storage, this may create the S3 bucket if it doesn't exist already.
func (*RemoteState) NeedsInit ¶ added in v0.13.0
func (remoteState *RemoteState) NeedsInit(terragruntOptions *options.TerragruntOptions) (bool, error)
Returns true if remote state needs to be configured. This will be the case when:
1. Remote state has not already been configured 2. Remote state has been configured, but with a different configuration 3. The remote state initializer for this backend type, if there is one, says initialization is necessary
func (*RemoteState) String ¶ added in v0.9.4
func (remoteState *RemoteState) String() string
func (RemoteState) ToTerraformInitArgs ¶ added in v0.12.3
func (remoteState RemoteState) ToTerraformInitArgs() []string
Convert the RemoteState config into the format used by the terraform init command
func (*RemoteState) Validate ¶
func (remoteState *RemoteState) Validate() error
Validate that the remote state is configured correctly
type RemoteStateConfigS3 ¶ added in v0.2.0
type RemoteStateConfigS3 struct { Encrypt bool `mapstructure:"encrypt"` Bucket string `mapstructure:"bucket"` Key string `mapstructure:"key"` Region string `mapstructure:"region"` Endpoint string `mapstructure:"endpoint"` Profile string `mapstructure:"profile"` RoleArn string `mapstructure:"role_arn"` LockTable string `mapstructure:"lock_table"` DynamoDBTable string `mapstructure:"dynamodb_table"` CredsFilename string `mapstructure:"shared_credentials_file"` S3ForcePathStyle bool `mapstructure:"force_path_style"` }
A representation of the configuration options available for S3 remote state
func (*RemoteStateConfigS3) GetAwsSessionConfig ¶ added in v0.16.9
func (c *RemoteStateConfigS3) GetAwsSessionConfig() *aws_helper.AwsSessionConfig
Builds a session config for AWS related requests from the RemoteStateConfigS3 configuration
func (*RemoteStateConfigS3) GetLockTableName ¶ added in v0.13.7
func (s3Config *RemoteStateConfigS3) GetLockTableName() string
The DynamoDB lock table name used to be called lock_table, but has since been renamed to dynamodb_table, and the old name deprecated. To maintain backwards compatibility, we support both names.
type RemoteStateInitializer ¶ added in v0.2.0
type RemoteStateInitializer interface { // Return true if remote state needs to be initialized NeedsInitialization(config map[string]interface{}, existingBackend *TerraformBackend, terragruntOptions *options.TerragruntOptions) (bool, error) // Initialize the remote state Initialize(config map[string]interface{}, terragruntOptions *options.TerragruntOptions) error // Return the config that should be passed on to terraform via -backend-config cmd line param // Allows the Backends to filter and/or modify the configuration given from the user GetTerraformInitArgs(config map[string]interface{}) map[string]interface{} }
type S3Initializer ¶ added in v0.13.6
type S3Initializer struct{}
func (S3Initializer) GetTerraformInitArgs ¶ added in v0.14.11
func (s3Initializer S3Initializer) GetTerraformInitArgs(config map[string]interface{}) map[string]interface{}
func (S3Initializer) Initialize ¶ added in v0.13.6
func (s3Initializer S3Initializer) Initialize(config map[string]interface{}, terragruntOptions *options.TerragruntOptions) error
Initialize the remote state S3 bucket specified in the given config. This function will validate the config parameters, create the S3 bucket if it doesn't already exist, and check that versioning is enabled.
func (S3Initializer) NeedsInitialization ¶ added in v0.13.6
func (s3Initializer S3Initializer) NeedsInitialization(config map[string]interface{}, existingBackend *TerraformBackend, terragruntOptions *options.TerragruntOptions) (bool, error)
Returns true if:
1. Any of the existing backend settings are different than the current config 2. The configured S3 bucket or DynamoDB table does not exist
type TerraformBackend ¶ added in v0.12.4
The structure of the "backend" section of the Terraform .tfstate file
type TerraformState ¶
type TerraformState struct { Version int Serial int Backend *TerraformBackend Modules []TerraformStateModule }
The structure of the Terraform .tfstate file
func ParseTerraformStateFile ¶
func ParseTerraformStateFile(path string) (*TerraformState, error)
Parse the Terraform .tfstate file at the given path
func ParseTerraformStateFileFromLocation ¶ added in v0.9.2
func ParseTerraformStateFileFromLocation(backend string, config map[string]interface{}, workingDir string) (*TerraformState, error)
Parses the Terraform .tfstate file. If a local backend is used then search the given path, or return nil if the file is missing. If the backend is not local then parse the Terraform .tfstate file from the location specified by workingDir. If no location is specified, search the current directory. If the file doesn't exist at any of the default locations, return nil.
func (*TerraformState) IsRemote ¶
func (state *TerraformState) IsRemote() bool
Return true if this Terraform state is configured for remote state storage
type TerraformStateModule ¶
type TerraformStateModule struct { Path []string Outputs map[string]interface{} Resources map[string]interface{} }
The structure of a "module" section of the Terraform .tfstate file