Skip to content

storage

The storage configuration allows users to define where plan files are stored, providing control over security and access. By default, plan files are stored on the Terrateam backend, but alternative methods are supported.

Default Configuration

storage:
plans:
method: terrateam

Storage Methods

The method key specifies how plans are stored:

S3-compatible Storage

To store plans in an S3-compatible storage, configure the following:

KeyTypeDescription
bucketStringBucket to store plans. Supports environment variables. Required.
regionStringRegion where the bucket resides. Supports environment variables. Required.
pathStringPath to store plans within the bucket. Defaults to terrateam/plans/$dir/$workspace/$date-$time-$token. See template variables for details.
access_key_idStringAccess key ID for authentication. Supports environment variables. Optional.
secret_access_keyStringSecret access key for authentication. Supports environment variables. Optional.
delete_used_plansBooleanDelete plan after use. Default is true.
store_extra_argsListAdditional arguments for aws s3 cp during storage. Optional.
fetch_extra_argsListAdditional arguments for aws s3 cp during fetching. Optional.
delete_extra_argsListAdditional arguments for aws s3 rm during deletion. Optional.

Custom Command Storage

For custom commands to store, fetch, and delete plans, configure:

KeyTypeDescription
deleteString listCommand to delete the plan after use. Supports environment and template variables. Optional.
fetchString listCommand to fetch the plan. Supports environment and template variables. Required.
storeString listCommand to store the plan. Supports environment and template variables. Required.

Template Variables

Variables available during plan and apply operations:

VariableDescription
dateDate of the plan operation in YYYY-MM-DD format.
dirDirectory being processed, e.g., foo/bar/baz.
plan_pathPath on disk where the plan is stored.
plan_dst_pathDestination path on disk for fetched plans.
timeTime of the plan operation in HHMMSS format.
tokenUnique token for the run.
workspaceWorkspace being processed, e.g., default.

Examples

Storing Plans in AWS S3

storage:
plans:
method: s3
bucket: my-plan-bucket
region: us-west-2
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY

Custom Commands for Plan Storage

storage:
plans:
method: cmd
store: ['gsutil', 'cp', '$plan_path', 'gs://my-plan-bucket/terrateam/plans/$dir/$workspace/$date-$time-$token']
fetch: ['gsutil', 'cp', 'gs://my-plan-bucket/terrateam/plans/$dir/$workspace/$date-$time-$token', '$plan_dst_path']
delete: ['gsutil', 'rm', 'gs://my-plan-bucket/terrateam/plans/$dir/$workspace/$date-$time-$token']