cs-image-system-tf-ebs-instance-plugin 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cs_image_system/py.typed +0 -0
- cs_image_system/tf_ebs_instance_plugin/__init__.py +3 -0
- cs_image_system/tf_ebs_instance_plugin/helpers.py +8 -0
- cs_image_system/tf_ebs_instance_plugin/main.py +74 -0
- cs_image_system/tf_ebs_instance_plugin/tf_instance_builder.py +677 -0
- cs_image_system/tf_ebs_instance_plugin/tf_instance_models.py +31 -0
- cs_image_system/tf_ebs_instance_plugin/tf_storage_builder.py +833 -0
- cs_image_system/tf_ebs_instance_plugin/tf_storage_models.py +95 -0
- cs_image_system_tf_ebs_instance_plugin-0.1.1.dist-info/METADATA +1376 -0
- cs_image_system_tf_ebs_instance_plugin-0.1.1.dist-info/RECORD +13 -0
- cs_image_system_tf_ebs_instance_plugin-0.1.1.dist-info/WHEEL +4 -0
- cs_image_system_tf_ebs_instance_plugin-0.1.1.dist-info/entry_points.txt +2 -0
- cs_image_system_tf_ebs_instance_plugin-0.1.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Mykel Alvis <mykelalvis@infrastructurebuilder.org>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from dataclasses import field
|
|
6
|
+
from cs_image_system.base.models.model_config import CSIS_MODEL_CONFIG
|
|
7
|
+
from pydantic.dataclasses import dataclass # stage 23: validation at construction
|
|
8
|
+
|
|
9
|
+
from cs_image_system.base.constants import DEFAULT, VCT
|
|
10
|
+
from cs_image_system.base.helpers.field_helpers import fk_field
|
|
11
|
+
from cs_image_system.base.models.module_variables import ModuleVariables
|
|
12
|
+
from cs_image_system.base.models.storage_builder import StorageBuilderModel
|
|
13
|
+
from cs_image_system.hashicorp_utils.hashicorp_models import TFTofuPluginModel
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
TF_AWS: str = "tf-aws"
|
|
17
|
+
TF_AWS_EBS = TF_AWS + "-ebs"
|
|
18
|
+
TF_AWS_EFS = TF_AWS + "-efs"
|
|
19
|
+
TF_AWS_S3 = TF_AWS + "-s3"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
23
|
+
class TofuStorageBuilderModel(StorageBuilderModel):
|
|
24
|
+
"""OpenTofu IaC storage builder configuration data object."""
|
|
25
|
+
type = TF_AWS
|
|
26
|
+
executable: str | None = "tofu"
|
|
27
|
+
required_plugins: list[TFTofuPluginModel] = field(default_factory=list)
|
|
28
|
+
state_configuration: str = fk_field(target=VCT.STATE_BACKEND_MODEL,
|
|
29
|
+
default=DEFAULT, metadata={
|
|
30
|
+
"description": "State backend used for this builder's terraform workspace",
|
|
31
|
+
})
|
|
32
|
+
# stage 26: declared inputs to the module call; each provider narrows the type
|
|
33
|
+
variables: ModuleVariables = field(default_factory=ModuleVariables)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def csis_name(cls) -> str:
|
|
38
|
+
return TF_AWS
|
|
39
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
40
|
+
class EbsVariables(ModuleVariables):
|
|
41
|
+
"""tfmodules/aws_storage_ebs: the tunables not derived from the storage
|
|
42
|
+
item (name, placement and the restore snapshot are computed)."""
|
|
43
|
+
volume_type: str | None = None
|
|
44
|
+
encrypted: bool | None = None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
48
|
+
class EfsVariables(ModuleVariables):
|
|
49
|
+
"""tfmodules/aws_storage_efs: access points, lifecycle transitions and
|
|
50
|
+
public_read come from the storage item."""
|
|
51
|
+
performance_mode: str | None = None
|
|
52
|
+
encrypted: bool | None = None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
56
|
+
class S3Variables(ModuleVariables):
|
|
57
|
+
"""tfmodules/aws_storage_s3: bucket name, prefixes, lifecycle rules and
|
|
58
|
+
public_read come from the storage item."""
|
|
59
|
+
force_destroy: bool | None = None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
63
|
+
class TofuEbsStorageBuilderModel(TofuStorageBuilderModel):
|
|
64
|
+
"""OpenTofu IaC builder configuration data object for EBS."""
|
|
65
|
+
type = TF_AWS_EBS
|
|
66
|
+
size: int = 100 # GB (a field since stage 26; was an untyped class attribute)
|
|
67
|
+
variables: EbsVariables = field(default_factory=EbsVariables)
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def csis_name(cls) -> str:
|
|
71
|
+
return TF_AWS_EBS
|
|
72
|
+
|
|
73
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
74
|
+
class TofuEfsStorageBuilderModel(TofuStorageBuilderModel):
|
|
75
|
+
"""OpenTofu IaC builder configuration data object for EFS."""
|
|
76
|
+
type = TF_AWS_EFS
|
|
77
|
+
variables: EfsVariables = field(default_factory=EfsVariables)
|
|
78
|
+
@classmethod
|
|
79
|
+
def csis_name(cls) -> str:
|
|
80
|
+
return TF_AWS_EFS
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@dataclass(kw_only=True, config=CSIS_MODEL_CONFIG)
|
|
84
|
+
class TofuS3StorageBuilderModel(TofuStorageBuilderModel):
|
|
85
|
+
"""OpenTofu IaC builder configuration data object for S3."""
|
|
86
|
+
bucket_name: str
|
|
87
|
+
type = TF_AWS_S3
|
|
88
|
+
variables: S3Variables = field(default_factory=S3Variables)
|
|
89
|
+
@classmethod
|
|
90
|
+
def csis_name(cls) -> str:
|
|
91
|
+
return TF_AWS_S3
|
|
92
|
+
|
|
93
|
+
def get_bucket_name(self) -> str:
|
|
94
|
+
return self.bucket_name
|
|
95
|
+
|