Skip to content

Local

The most basic storage provider - that uses local disk paths.
It can be used for basic rigging over local disk paths.

Tip

This provider allow you to use shared disk paths as well - like NFS folders or FUSE mounts using rclone

Initialization

LocalStorageProviderInitConfig

Initialization params required to initialize Local storage provider.

Attributes:

Name Type Description
folder Path

The path to the directory where the files will be stored.

folder_mode int

The mode to set on the folder. Default: 0o700.

file_mode int

The mode to set on the files. Default: 0o600.

Source code in terraflex/plugins/local_storage_provider/local_storage_provider.py
29
30
31
32
33
34
35
36
37
38
39
40
class LocalStorageProviderInitConfig(BaseModel):
    """Initialization params required to initialize Local storage provider.

    Attributes:
        folder: The path to the directory where the files will be stored.
        folder_mode: The mode to set on the folder. Default: 0o700.
        file_mode: The mode to set on the files. Default: 0o600.
    """

    folder: pathlib.Path
    folder_mode: int = 0o700
    file_mode: int = 0o600

ItemKey

LocalStorageProviderItemIdentifier

Bases: ItemKey

Params required to reference an item in Local storage provider.

Attributes:

Name Type Description
path str

The path to a specific file relative to the directory root, folders are also allowed as part of the path.

Source code in terraflex/plugins/local_storage_provider/local_storage_provider.py
14
15
16
17
18
19
20
21
22
23
24
25
26
class LocalStorageProviderItemIdentifier(ItemKey):
    """Params required to reference an item in Local storage provider.

    Attributes:
        path: The path to a specific file relative to the directory root,
            folders are also allowed as part of the path.
    """

    path: str

    @override
    def as_string(self) -> str:
        return self.path

Example

terraflex.yaml
storage_providers:
  local: # Initialize new storage provider - name can be anything
    type: local
    folder: ~/states/

  encryption-dir:
    type: local
    folder: ~/secrets/

transformers:
  encryption: # Initialize new transformer - Name can be anything, we use `encryption` for semantics.
    type: encryption # In this case we use `encryption` transformer
    key_type: age # We use `age` as the encryption provider
    import_from_storage:
      provider: encryption-dir # Make sure name is matching your storage provider
      params:
        path: age-key.txt # The path to the encryption key file inside ~/secrets/

stacks:
  my-stack: # Initialize new stack - Name can be anything
    transformers: # List of transformers to use in this specific stack
      - encryption # Make sure name is matching your transformer
    state_storage: # Terraform state storage configuration
      provider: local # In this case we use our local storage provider
      params:
        path: terraform.tfstate # The path to the state file inside our repository