atlas-init 0.4.2__py3-none-any.whl → 0.4.4__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.
Files changed (34) hide show
  1. atlas_init/__init__.py +3 -7
  2. atlas_init/cli.py +2 -1
  3. atlas_init/cli_cfn/app.py +3 -5
  4. atlas_init/cli_cfn/cfn_parameter_finder.py +1 -28
  5. atlas_init/cli_cfn/contract.py +5 -3
  6. atlas_init/cli_cfn/example.py +8 -6
  7. atlas_init/cli_helper/go.py +18 -14
  8. atlas_init/cli_helper/tf_runner.py +14 -11
  9. atlas_init/cli_root/trigger.py +21 -8
  10. atlas_init/cli_tf/app.py +1 -1
  11. atlas_init/cli_tf/debug_logs.py +4 -4
  12. atlas_init/cli_tf/example_update.py +3 -3
  13. atlas_init/cli_tf/github_logs.py +4 -16
  14. atlas_init/cli_tf/hcl/modifier.py +115 -14
  15. atlas_init/cli_tf/mock_tf_log.py +4 -3
  16. atlas_init/cli_tf/schema_v2.py +2 -2
  17. atlas_init/cli_tf/schema_v2_api_parsing.py +3 -3
  18. atlas_init/cli_tf/schema_v3.py +2 -2
  19. atlas_init/cli_tf/schema_v3_sdk_base.py +1 -1
  20. atlas_init/settings/env_vars.py +119 -142
  21. atlas_init/settings/env_vars_generated.py +40 -9
  22. atlas_init/settings/env_vars_modules.py +71 -0
  23. atlas_init/settings/path.py +4 -10
  24. atlas_init/typer_app.py +3 -3
  25. {atlas_init-0.4.2.dist-info → atlas_init-0.4.4.dist-info}/METADATA +6 -5
  26. {atlas_init-0.4.2.dist-info → atlas_init-0.4.4.dist-info}/RECORD +29 -32
  27. atlas_init-0.4.4.dist-info/licenses/LICENSE +21 -0
  28. atlas_init/cli_tf/example_update_test/test_update_example.tf +0 -23
  29. atlas_init/cli_tf/example_update_test.py +0 -96
  30. atlas_init/cli_tf/hcl/modifier_test/test_process_variables_output_.tf +0 -25
  31. atlas_init/cli_tf/hcl/modifier_test/test_process_variables_variable_.tf +0 -24
  32. atlas_init/cli_tf/hcl/modifier_test.py +0 -95
  33. {atlas_init-0.4.2.dist-info → atlas_init-0.4.4.dist-info}/WHEEL +0 -0
  34. {atlas_init-0.4.2.dist-info → atlas_init-0.4.4.dist-info}/entry_points.txt +0 -0
@@ -1,18 +1,55 @@
1
1
  import random
2
+ from typing import Self
2
3
 
3
- from pydantic import ConfigDict, Field
4
+ from pydantic import ConfigDict, Field, model_validator
4
5
  from pydantic_settings import BaseSettings
5
6
 
6
7
 
7
8
  class _EnvVarsGenerated(BaseSettings):
8
9
  model_config = ConfigDict(extra="ignore") # type: ignore
9
10
 
11
+ @classmethod
12
+ def from_env(cls) -> Self:
13
+ return cls()
14
+
10
15
 
11
16
  class AtlasSettings(_EnvVarsGenerated):
12
17
  MONGODB_ATLAS_ORG_ID: str
13
18
  MONGODB_ATLAS_PRIVATE_KEY: str
14
19
  MONGODB_ATLAS_PUBLIC_KEY: str
15
- MONGODB_ATLAS_BASE_URL: str = "https://cloud-dev.mongodb.com/"
20
+ MONGODB_ATLAS_BASE_URL: str
21
+
22
+ @property
23
+ def realm_url(self) -> str:
24
+ assert not self.is_mongodbgov_cloud, "realm_url is not supported for mongodbgov cloud"
25
+ if "cloud-dev." in self.MONGODB_ATLAS_BASE_URL:
26
+ return "https://services.cloud-dev.mongodb.com/"
27
+ return "https://services.cloud.mongodb.com/"
28
+
29
+ @property
30
+ def is_mongodbgov_cloud(self) -> bool:
31
+ return "mongodbgov" in self.MONGODB_ATLAS_BASE_URL
32
+
33
+
34
+ class AWSSettings(_EnvVarsGenerated):
35
+ AWS_REGION: str
36
+ AWS_PROFILE: str = ""
37
+ AWS_ACCESS_KEY_ID: str = ""
38
+ AWS_SECRET_ACCESS_KEY: str = ""
39
+
40
+ @model_validator(mode="after")
41
+ def ensure_credentials_are_given(self) -> Self:
42
+ assert self.AWS_PROFILE or (self.AWS_ACCESS_KEY_ID and self.AWS_SECRET_ACCESS_KEY), (
43
+ "Either AWS_PROFILE or both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be provided"
44
+ )
45
+ assert not (self.AWS_PROFILE and (self.AWS_ACCESS_KEY_ID and self.AWS_SECRET_ACCESS_KEY)), (
46
+ "Either AWS_PROFILE or both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be provided, not both"
47
+ )
48
+ return self
49
+
50
+
51
+ class TerraformSettings(_EnvVarsGenerated):
52
+ TF_CLI_CONFIG_FILE: str
16
53
 
17
54
 
18
55
  class RealmSettings(_EnvVarsGenerated):
@@ -24,11 +61,5 @@ class RealmSettings(_EnvVarsGenerated):
24
61
  RANDOM_INT_100K: str = Field(default_factory=lambda: str(random.randint(0, 100_000))) # noqa: S311 # not used for cryptographic purposes # nosec
25
62
 
26
63
 
27
- class EnvVarsGenerated(AtlasSettings):
64
+ class AtlasSettingsWithProject(AtlasSettings):
28
65
  MONGODB_ATLAS_PROJECT_ID: str
29
-
30
-
31
- class TFModuleCluster(_EnvVarsGenerated):
32
- MONGODB_ATLAS_CLUSTER_NAME: str
33
- MONGODB_ATLAS_CONTAINER_ID: str
34
- MONGODB_URL: str
@@ -0,0 +1,71 @@
1
+ from atlas_init.settings.env_vars_generated import _EnvVarsGenerated
2
+
3
+
4
+ class TFModuleAws_S3(_EnvVarsGenerated):
5
+ AWS_S3_BUCKET: str
6
+
7
+
8
+ class TFModuleAws_Vars(_EnvVarsGenerated):
9
+ AWS_ACCESS_KEY_ID: str
10
+ AWS_CUSTOMER_MASTER_KEY_ID: str
11
+ AWS_REGION: str
12
+ AWS_REGION_LOWERCASE: str
13
+ AWS_REGION_UPPERCASE: str
14
+ AWS_SECRET_ACCESS_KEY: str
15
+
16
+
17
+ class TFModuleAws_Vpc(_EnvVarsGenerated):
18
+ AWS_SECURITY_GROUP_ID: str
19
+ AWS_SUBNET_ID: str
20
+ AWS_VPC_CIDR_BLOCK: str
21
+ AWS_VPC_ID: str
22
+
23
+
24
+ class TFModuleCfn(_EnvVarsGenerated):
25
+ CFN_EXAMPLE_EXECUTION_ROLE: str
26
+ MONGODB_ATLAS_PRIVATE_API_KEY: str
27
+ MONGODB_ATLAS_PROFILE: str
28
+ MONGODB_ATLAS_PUBLIC_API_KEY: str
29
+ MONGODB_ATLAS_SECRET_PROFILE: str
30
+
31
+
32
+ class TFModuleCloud_Provider(_EnvVarsGenerated):
33
+ AWS_IAM_ROLE_ARN: str
34
+ IAM_ROLE_ID: str
35
+
36
+
37
+ class TFModuleCluster(_EnvVarsGenerated):
38
+ MONGODB_ATLAS_CLUSTER_NAME: str
39
+ MONGODB_ATLAS_CONTAINER_ID: str
40
+ MONGODB_URL: str
41
+
42
+
43
+ class TFModuleFederated_Vars(_EnvVarsGenerated):
44
+ MONGODB_ATLAS_FEDERATED_GROUP_ID: str
45
+ MONGODB_ATLAS_FEDERATED_IDP_ID: str
46
+ MONGODB_ATLAS_FEDERATED_ORG_ID: str
47
+ MONGODB_ATLAS_FEDERATED_SETTINGS_ASSOCIATED_DOMAIN: str
48
+ MONGODB_ATLAS_FEDERATION_SETTINGS_ID: str
49
+
50
+
51
+ class TFModuleProject_Extra(_EnvVarsGenerated):
52
+ MONGODB_ATLAS_ORG_API_KEY_ID: str
53
+ MONGODB_ATLAS_TEAMS_IDS: str
54
+ MONGODB_ATLAS_TEAM_ID: str
55
+
56
+
57
+ class TFModuleStream_Instance(_EnvVarsGenerated):
58
+ MONGODB_ATLAS_STREAM_INSTANCE_ID: str
59
+ MONGODB_ATLAS_STREAM_INSTANCE_NAME: str
60
+
61
+
62
+ class TFModuleVpc_Peering(_EnvVarsGenerated):
63
+ AWS_ACCOUNT_ID: str
64
+ AWS_REGION: str
65
+ AWS_VPC_CIDR_BLOCK: str
66
+ AWS_VPC_ID: str
67
+
68
+
69
+ class TFModuleVpc_Privatelink(_EnvVarsGenerated):
70
+ MONGODB_ATLAS_PRIVATE_ENDPOINT_DNS_NAME: str
71
+ MONGODB_ATLAS_PRIVATE_ENDPOINT_ID: str
@@ -12,8 +12,7 @@ from atlas_init import running_in_repo
12
12
  logger = logging.getLogger(__name__)
13
13
  """WARNING these variables should only be used through the AtlasInitSettings, not directly"""
14
14
  if running_in_repo():
15
- ROOT_PATH = Path(__file__).parent.parent.parent.parent # atlas_init REPO_PATH
16
- DEFAULT_PROFILES_PATH = ROOT_PATH / "profiles"
15
+ ROOT_PATH = Path(__file__).parent.parent.parent # atlas_init REPO_PATH
17
16
  else:
18
17
  ROOT_PATH = Path(__file__).parent.parent # site package install directory
19
18
  _default_profiles_path = os.environ.get("ATLAS_INIT_PROFILES_PATH")
@@ -21,14 +20,9 @@ else:
21
20
  _default_profiles_path = Path(user_data_dir("atlas_init")) / "profiles"
22
21
  warning_msg = f"os.environ['ATLAS_INIT_PROFILES_PATH'] is not set using default: {_default_profiles_path}"
23
22
  logger.warning(warning_msg)
24
- DEFAULT_PROFILES_PATH = Path(_default_profiles_path)
25
- DEFAULT_PROFILES_PATH.mkdir(exist_ok=True, parents=True)
26
- DEFAULT_TF_PATH = ROOT_PATH / "tf"
27
- DEFAULT_CONFIG_PATH = ROOT_PATH / "atlas_init.yaml"
28
- DEFAULT_SCHEMA_CONFIG_PATH = ROOT_PATH / "terraform.yaml"
29
- DEFAULT_GITHUB_CI_RUN_LOGS = ROOT_PATH / "github_ci_run_logs"
30
- DEFAULT_GITHUB_SUMMARY_DIR = ROOT_PATH / "github_ci_summary"
31
- DEFAULT_DOWNLOADS_DIR = ROOT_PATH / "downloads"
23
+ DEFAULT_TF_SRC_PATH = ROOT_PATH / "tf"
24
+ DEFAULT_ATLAS_INIT_CONFIG_PATH = ROOT_PATH / "atlas_init.yaml"
25
+ DEFAULT_ATLAS_INIT_SCHEMA_CONFIG_PATH = ROOT_PATH / "terraform.yaml"
32
26
 
33
27
 
34
28
  def load_dotenv(env_path: Path) -> dict[str, str]:
atlas_init/typer_app.py CHANGED
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
26
26
 
27
27
  def sync_on_done(return_value, s3_profile_bucket: str = "", use_clipboard: str = "", **kwargs):
28
28
  logger.info(f"sync_on_done return_value={return_value} and {kwargs}")
29
- settings = init_settings(non_required=True)
29
+ settings = init_settings()
30
30
  if s3_profile_bucket:
31
31
  logger.info(f"using s3 bucket for profile sync: {s3_profile_bucket}")
32
32
  upload_to_s3(settings.profile_dir, s3_profile_bucket)
@@ -110,9 +110,9 @@ def main(
110
110
  logger.info(f"in the app callback, log-level: {log_level}, command: {format_cmd(ctx)}")
111
111
  if s3_bucket := s3_profile_bucket:
112
112
  logger.info(f"using s3 bucket for profile sync: {s3_bucket}")
113
- settings = init_settings(non_required=True)
113
+ settings = init_settings()
114
114
  download_from_s3(settings.profile_dir, s3_bucket)
115
- settings = init_settings(required_env_vars=[])
115
+ settings = init_settings()
116
116
  if not show_secrets:
117
117
  # must happen after init_settings that might load some env-vars
118
118
  hide_secrets(handler, {**os.environ})
@@ -1,15 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlas-init
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Project-URL: Documentation, https://github.com/EspenAlbert/atlas-init#readme
5
5
  Project-URL: Issues, https://github.com/EspenAlbert/atlas-init/issues
6
6
  Project-URL: Source, https://github.com/EspenAlbert/atlas-init
7
7
  Author-email: EspenAlbert <albertespen@gmail.com>
8
8
  License-Expression: MIT
9
+ License-File: LICENSE
9
10
  Classifier: Development Status :: 4 - Beta
10
11
  Classifier: Programming Language :: Python
11
- Classifier: Programming Language :: Python :: 3.12
12
- Requires-Python: >=3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Python: >=3.13
13
14
  Requires-Dist: appdirs==1.4.4
14
15
  Requires-Dist: boto3==1.35.92
15
16
  Requires-Dist: gitpython==3.1.42
@@ -19,7 +20,7 @@ Requires-Dist: mypy-boto3-cloudformation==1.37.22
19
20
  Requires-Dist: orjson==3.10.13
20
21
  Requires-Dist: pydantic-settings==2.7.1
21
22
  Requires-Dist: pygithub==2.6.1
22
- Requires-Dist: python-hcl2==6.1.0
23
+ Requires-Dist: python-hcl2==7.1.0
23
24
  Requires-Dist: requests==2.32.2
24
25
  Requires-Dist: rich==14.0.0
25
26
  Requires-Dist: stringcase==1.2.0
@@ -119,7 +120,7 @@ atlas_init # should show how to use the cli
119
120
  ```
120
121
 
121
122
  ### CI Installation Tests (`pip install` local wheel)
122
- - [atlasci_local_install](atlasci_local_install.sh)
123
+ - `uv sync`
123
124
  - creates a local `.venv` builds the wheel from this repo and installs it
124
125
  - use `export ATLAS_INIT_PROFILES_PATH=/somewhere/to/store/your/env-vars/and/tf/state`
125
126
 
@@ -1,62 +1,57 @@
1
- atlas_init/__init__.py,sha256=mdnD1EIENrrNoygcsXJXBVXaCItR3hi-Eys2B7KqVoM,372
1
+ atlas_init/__init__.py,sha256=fKwzi8Wa5MHwzV_nRwgzWoqouQipF_xSLut36HZJhxc,213
2
2
  atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
3
3
  atlas_init/atlas_init.yaml,sha256=Q_gFMbTa8OKxS8GbjszyrMA05nap8HI_Oe-cgQZNEPk,2351
4
- atlas_init/cli.py,sha256=znbyirZl_tChG4SoGQPEM5iSsJiSVslCdExSja1qvUo,9262
4
+ atlas_init/cli.py,sha256=f7Y_i5_g8LrIE6GJRCQrpF4gN9HMSL3I_y1TYDfqwgw,9366
5
5
  atlas_init/cli_args.py,sha256=tiwUYAE0JBSl9lHV6VJ41vFCU90ChBZ4mKvi-YoF_HY,541
6
6
  atlas_init/humps.py,sha256=l0ZXXuI34wwd9TskXhCjULfGbUyK-qNmiyC6_2ow6kU,7339
7
7
  atlas_init/terraform.yaml,sha256=qPrnbzBEP-JAQVkYadHsggRnDmshrOJyiv0ckyZCxwY,2734
8
- atlas_init/typer_app.py,sha256=RjOZRIV-hacWksgjLB0ip4DgA1fz5x-yHRWuSwSGEws,4254
8
+ atlas_init/typer_app.py,sha256=icuru2-TzP7FtSIfXZRe4WbANVvYBexD5awKzpWTszo,4200
9
9
  atlas_init/cli_cfn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- atlas_init/cli_cfn/app.py,sha256=DCwEp7kwJMytuy13jHr2M1jJ6sMWTthOc-LkHtNvoew,6104
10
+ atlas_init/cli_cfn/app.py,sha256=6TZvJ-K5vhFH_mwZ4sf7QIBdRVxGMS8Vhi7h-3hZa7Y,6106
11
11
  atlas_init/cli_cfn/aws.py,sha256=KtJWJmYDknPFtd4j6evMFRwmnFGcLYUFHArV6J49TjI,17911
12
- atlas_init/cli_cfn/cfn_parameter_finder.py,sha256=tAadNF1M_U2BTY-m9fXVXFXNQRvfudOja97jT3AiVaI,10811
13
- atlas_init/cli_cfn/contract.py,sha256=6gRCvKRh6bn6BiQ3wyai_XNUwbWSqSRlg5GFvSdEcRc,7886
14
- atlas_init/cli_cfn/example.py,sha256=_JuFyNEb7QvD4T8jQyAPI3TgnHW0wz0kVuncB5UkbEA,8530
12
+ atlas_init/cli_cfn/cfn_parameter_finder.py,sha256=FYqVAygQtcXg4YX9CaJnaGbWN80xhYhGtjOmPs6R2OA,9447
13
+ atlas_init/cli_cfn/contract.py,sha256=oVocGvgy9EKHFqtWt9D2Iupfka0H31DJe1Oa5_003cE,8031
14
+ atlas_init/cli_cfn/example.py,sha256=51_liiS6cu5l7HqPbW9solJutTyRprto3oiQ2aRxgGQ,8708
15
15
  atlas_init/cli_cfn/files.py,sha256=kwKDh__O__it2Shz3pHhnle4XUesRd4P929twxUODfI,2651
16
16
  atlas_init/cli_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- atlas_init/cli_helper/go.py,sha256=WN3p7GXQNDtDl1M3rJ1Qhv2mz89Jow0BWucHnwLfUQs,9725
17
+ atlas_init/cli_helper/go.py,sha256=tT5Z8QU3CtvFAsSiOoerfGVYCQMSHc_CwRAAkHj45CM,9867
18
18
  atlas_init/cli_helper/run.py,sha256=va1eFP-hRvM76lVzvqH8eqGnyfcbzgR0zCMbL9Neb58,3660
19
19
  atlas_init/cli_helper/run_manager.py,sha256=USNRHSm1zuu4H9NRamnxQ2D4gKzrHLk8dZe0G95Be14,9022
20
20
  atlas_init/cli_helper/sdk.py,sha256=exh58-VZwxtosaxM269C62EEy1VnpJPOVziPDPkGsmE,2983
21
21
  atlas_init/cli_helper/sdk_auto_changes.py,sha256=oWyXw7P0PdO28hclRvza_RcIVXAyzu0lCYTJTNBDMeo,189
22
- atlas_init/cli_helper/tf_runner.py,sha256=ZEh4WlI-6RV84uBtGNcFgAr8M03As-BLz4fu9wCPULw,3327
22
+ atlas_init/cli_helper/tf_runner.py,sha256=V8pfxPSDBSeQWkR27kI8JLu-MEadUR9TGnoXBjSP4G4,3610
23
23
  atlas_init/cli_root/__init__.py,sha256=Mf0wqy4kqq8pmbjLa98zOGuUWv0bLk2OYGc1n1_ZmZ4,223
24
24
  atlas_init/cli_root/go_test.py,sha256=roQIOS-qVfNhJMztR-V3hjtxFMf7-Ioy3e1ffqtTRyo,4601
25
- atlas_init/cli_root/trigger.py,sha256=In3oS-z8gYYsPxQjHsGmqB1AsUtHPDTxwva5arsajvU,8227
25
+ atlas_init/cli_root/trigger.py,sha256=M2B-c5m88Fz5V9Gl7fU_QkfhDYoxlJoRk38C0EY-iwU,8482
26
26
  atlas_init/cli_tf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- atlas_init/cli_tf/app.py,sha256=6dFc9NMaM25vC4BMa8HCDDks9dD74nwauD70GnWBmZU,11600
27
+ atlas_init/cli_tf/app.py,sha256=Y3cAj8XbOT8FESSpVagOuQyfplWSaJPz9lYiigyNj0M,11611
28
28
  atlas_init/cli_tf/changelog.py,sha256=biWYKf1pZvXZ-jEgcZ5q9sY7nTGrL2PuI0h9mCILf_g,3181
29
- atlas_init/cli_tf/debug_logs.py,sha256=P78XnlvBj0rBSceLF3nIuHPIRBnKKw1Ya2gY2zkbTsU,10046
29
+ atlas_init/cli_tf/debug_logs.py,sha256=50J3wgfbdcMLPJ5_7qLkUuEXeZwFvjqyusXKgrcKMls,10048
30
30
  atlas_init/cli_tf/debug_logs_test_data.py,sha256=s85x78pFweVyqL2BchkLuvuG9hm-bwl8zcSO-IQqm6c,9736
31
31
  atlas_init/cli_tf/debug_logs_test_data_package_config.py,sha256=BOAgln1pWne_ZhP6a0SM2ddn2csr0sgGkYf2kMS_V9o,1666
32
- atlas_init/cli_tf/example_update.py,sha256=xCXm6n0fSfPCnv9GyXBfPz7ljFe8Y4WPFZaXf_qDa68,5254
33
- atlas_init/cli_tf/example_update_test.py,sha256=EI_6ZsOaGt7iX2JvJ3rvv3B2zKRRjI-d3P8R-tvgFc8,2859
34
- atlas_init/cli_tf/github_logs.py,sha256=jJs74npytc7f_nxmUG_CgWpBrKCuF5nZtpwsSii-3XY,8365
32
+ atlas_init/cli_tf/example_update.py,sha256=YctAKZUb932x4VHBI_5T_0jOIbMDYdJaSOVVjJRUMEM,5256
33
+ atlas_init/cli_tf/github_logs.py,sha256=LSF3LZVEnvPZ7QngX4SpIfgU-BHSZSbDa8fHuC1vCrA,7806
35
34
  atlas_init/cli_tf/go_test_run.py,sha256=BrEX-U7wGd4pV_PZycttbbBgG2ac0vOLeJwm65zFTmo,7420
36
35
  atlas_init/cli_tf/go_test_summary.py,sha256=4hPjT5gKRixXWO6NtTRkavDXPIZmC0TJ-7GhN2h33H0,5590
37
36
  atlas_init/cli_tf/log_clean.py,sha256=lVbw6fDstr9HanGVEv6zBcfs_4aR2TcPHCIx1poU5sY,926
38
- atlas_init/cli_tf/mock_tf_log.py,sha256=-ZOtQmy9w7k7HvrywMqlgohZ6Kerojk-P_xtiTaZ4sc,7555
37
+ atlas_init/cli_tf/mock_tf_log.py,sha256=zeW8Vdv8U6R9wJcdPpNBeLIxfSt3u5B5NJE6PNJegD8,7577
39
38
  atlas_init/cli_tf/schema.py,sha256=iwvb4wD2Wba0MMu7ooTNAIi1jHbpLiXGPOT51_o_YW8,12431
40
39
  atlas_init/cli_tf/schema_go_parser.py,sha256=PiRfFFVnkhltxcGFfOCgH53wwzIEynw2BXmSfaINLL8,8294
41
40
  atlas_init/cli_tf/schema_inspection.py,sha256=ujLvGfg3baByND4nRD0drZoI45STxo3VfYvim-PfVOc,1764
42
41
  atlas_init/cli_tf/schema_table.py,sha256=sxH-WUvBOHPI-HH2-2Y_MwKN-_POlQX3599h6YbfY1U,5261
43
42
  atlas_init/cli_tf/schema_table_models.py,sha256=9gS3gYris0MjEWsY_gbLWcZwJokCUJS1TcVXnq7w5SA,5003
44
- atlas_init/cli_tf/schema_v2.py,sha256=NtVW3lPKxHtCMBEwo9zThARpy9oQRbsKd0NrhymAyyE,21960
45
- atlas_init/cli_tf/schema_v2_api_parsing.py,sha256=8XtwHNU84VPMATD3CbE-TLeVlgxqZggxY5QQ5YjhX4w,12888
43
+ atlas_init/cli_tf/schema_v2.py,sha256=IKVsyY2wg3SufXi5LPdC6a9FmI4N_8CPZbrnKcwZJcw,21960
44
+ atlas_init/cli_tf/schema_v2_api_parsing.py,sha256=ktZ1-XzOmvtzlz4ztgbOQ60y_5kF_NQDMmqvR9aOoVg,12888
46
45
  atlas_init/cli_tf/schema_v2_sdk.py,sha256=AsAERT18FC97Gdb8r-qFInr4pSA15IGMUvCn-065XGE,12630
47
- atlas_init/cli_tf/schema_v3.py,sha256=LUeI2kniUDfd-5iP1TCLXb-Js92VYSXB6FCVLDYAIak,5788
46
+ atlas_init/cli_tf/schema_v3.py,sha256=RAEDl29Lh7XWvKsRDGnfMpV3S5bRRv5rQpFXDpl6wrU,5805
48
47
  atlas_init/cli_tf/schema_v3_sdk.py,sha256=5RWbhqKT8jEGgJrQaaT7xTRToviIzZZOxuJO5MNLYwo,9929
49
- atlas_init/cli_tf/schema_v3_sdk_base.py,sha256=oe7WRZc0R_UYP5Yry4kDAMxOKAUHvQrc9bIdjfLshYk,2131
48
+ atlas_init/cli_tf/schema_v3_sdk_base.py,sha256=htwSy_XyrN42cRyPnvkE8rK1WL5OIsXTR90ilQB4_TY,2137
50
49
  atlas_init/cli_tf/schema_v3_sdk_create.py,sha256=64AluGbQP47RRdY6Cz4KZRN9DdQISW5lLxQ-E1od5dc,8342
51
- atlas_init/cli_tf/example_update_test/test_update_example.tf,sha256=Bun55357kL84VuWpVx7XvpZHndkY6s8VfFPGAkK_DzA,524
52
50
  atlas_init/cli_tf/hcl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
51
  atlas_init/cli_tf/hcl/cli.py,sha256=6V1kU_a1c4LA3rS7sWN821gQex00fb70AUyd07xO0es,5760
54
52
  atlas_init/cli_tf/hcl/cluster_mig.py,sha256=kMb_0V_XWr_iQj-mZZ-mmzIvYOLfuC4FYGYYSe9VKkQ,12496
55
- atlas_init/cli_tf/hcl/modifier.py,sha256=zmfHgRR48IECF-8Pj915kCjM0VrW2KAAQu1KDDgDF9Y,4817
56
- atlas_init/cli_tf/hcl/modifier_test.py,sha256=Jdqa-iZ1ifbz_yIsjD055meFMZJpetx_abg1W4LVBZ8,2740
53
+ atlas_init/cli_tf/hcl/modifier.py,sha256=Ogx6qZjgfBIr4rm1f8m6nhY_6FmqFuFR8-INiAZgeoo,7793
57
54
  atlas_init/cli_tf/hcl/parser.py,sha256=wqj0YIn9nyEfjRqZnM7FH4yL43-K9ANvRiy9RCahImc,4833
58
- atlas_init/cli_tf/hcl/modifier_test/test_process_variables_output_.tf,sha256=GMRAFFlBWOg8Fu5mQDMIA7SWD-sSjkCBe__gIsop3mA,646
59
- atlas_init/cli_tf/hcl/modifier_test/test_process_variables_variable_.tf,sha256=2vVCTHkqP0aud1EA428LMsPnUeTRYGFkb3RlDxsKszk,605
60
55
  atlas_init/cloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
56
  atlas_init/cloud/aws.py,sha256=AXVobJ724S6OeEs_uXH9dvecc_klnXqejRnI7KaLyzo,4935
62
57
  atlas_init/repos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -65,10 +60,11 @@ atlas_init/repos/go_sdk.py,sha256=1OzM9DjHEAzAAuI9ygoRRuhUK2gqpOhXExXRqhqa0tg,17
65
60
  atlas_init/repos/path.py,sha256=5XsXrxpyQi2bkV_qOtbIhL7-XGwW68XUmCTOdyfoz1A,4517
66
61
  atlas_init/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
62
  atlas_init/settings/config.py,sha256=Cb483vmKOnNUK6m5KlhDiGeDJcZoJ1vHREdiddYONuQ,7037
68
- atlas_init/settings/env_vars.py,sha256=1M4EKveUbrHaEuSyWyZ_bdK7MUTHhBu8-tFGSimqCCI,10659
69
- atlas_init/settings/env_vars_generated.py,sha256=c3dMShnSvqLsiJTIMoHCpC9Tvk35b5lra40Ske9l4gE,980
63
+ atlas_init/settings/env_vars.py,sha256=_o5FiIPAlsayn2kKqilIttr5HVZbixtbXQRXtnsxBJg,9862
64
+ atlas_init/settings/env_vars_generated.py,sha256=eUKjyv0pFxWGzbSpAdjHnx3v2t1rtioV4wdNFwEg8J8,2121
65
+ atlas_init/settings/env_vars_modules.py,sha256=fqVndOn8ZesuudijakzPZKsrXnm-iezGHvVx2bOng2o,1810
70
66
  atlas_init/settings/interactive.py,sha256=Xy1Z5WMAOSaJ-vQI_4xjAbSR92rWQgnffwVoDT27L68,340
71
- atlas_init/settings/path.py,sha256=KkXysu6-0AuSjsvYGknYGJX1hL2j1RD-Fpf8KsVYpkE,2618
67
+ atlas_init/settings/path.py,sha256=vFRmoUHQplWuKsICu8uHPNAYhsuJu_xoVhmTnii_p7M,2301
72
68
  atlas_init/settings/rich_utils.py,sha256=mjYCZ7Sx-OTsjv7AZ4qyjXqvq3TOaczLfDjOQK_dKWk,2012
73
69
  atlas_init/tf/.terraform.lock.hcl,sha256=71G7Kov2C4M0qOIyeIL90Vw8j8nkJktNUT3uPwUOu5w,6876
74
70
  atlas_init/tf/always.tf,sha256=ij6QKI8Lg0140bFZwOyiYK5c-2p5e7AGZ1qKbYyv6Os,1359
@@ -102,7 +98,8 @@ atlas_init/tf/modules/vpc_peering/vpc_peering.tf,sha256=hJ3KJdGbLpOQednUpVuiJ0Cq
102
98
  atlas_init/tf/modules/vpc_privatelink/atlas-privatelink.tf,sha256=FloaaX1MNDvoMZxBnEopeLKyfIlq6kaX2dmx8WWlXNU,1298
103
99
  atlas_init/tf/modules/vpc_privatelink/variables.tf,sha256=gktHCDYD4rz6CEpLg5aiXcFbugw4L5S2Fqc52QYdJyc,255
104
100
  atlas_init/tf/modules/vpc_privatelink/versions.tf,sha256=G0u5V_Hvvrkux_tqfOY05pA-GzSp_qILpfx1dZaTGDc,237
105
- atlas_init-0.4.2.dist-info/METADATA,sha256=jPqN8mPKb77ojXt7dDWWFk54KhwGxb2hhYWQh7Mv3nc,5741
106
- atlas_init-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
107
- atlas_init-0.4.2.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
108
- atlas_init-0.4.2.dist-info/RECORD,,
101
+ atlas_init-0.4.4.dist-info/METADATA,sha256=MAw0QaKaLYdAH9NW_6xXSNc6a-8NAm5yBWRAXkE9Ogo,5723
102
+ atlas_init-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
103
+ atlas_init-0.4.4.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
104
+ atlas_init-0.4.4.dist-info/licenses/LICENSE,sha256=aKnucPyXnK1A-aXn4vac71zRpcB5BXjDyl4PDyi_hZg,1069
105
+ atlas_init-0.4.4.dist-info/RECORD,,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Espen Albert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,23 +0,0 @@
1
- variable "cluster_name" {
2
- description = "description of cluster name"
3
- type = string
4
- }
5
- variable "replication_specs" {
6
- description = "Updated description"
7
- default = []
8
- type = list(object({
9
- num_shards = number
10
- zone_name = string
11
- regions_config = set(object({
12
- region_name = string
13
- electable_nodes = number
14
- priority = number
15
- read_only_nodes = optional(number, 0)
16
- }))
17
- }))
18
- }
19
-
20
- variable "provider_name" {
21
- type = string
22
- default = "" # optional in v3
23
- }
@@ -1,96 +0,0 @@
1
- import os
2
- from pathlib import Path
3
-
4
- import pytest
5
-
6
- from atlas_init.cli_tf.example_update import (
7
- TFConfigDescriptionChange,
8
- UpdateExamples,
9
- update_examples,
10
- )
11
- from atlas_init.cli_tf.hcl.modifier import BLOCK_TYPE_VARIABLE, update_descriptions
12
-
13
-
14
- def test_description_change(tmp_path):
15
- assert TFConfigDescriptionChange(
16
- block_type=BLOCK_TYPE_VARIABLE,
17
- path=tmp_path,
18
- name="cluster_name",
19
- before="",
20
- after="description of cluster name",
21
- ).changed
22
- assert not TFConfigDescriptionChange(
23
- block_type=BLOCK_TYPE_VARIABLE,
24
- path=tmp_path,
25
- name="cluster_name",
26
- before="description of cluster name",
27
- after="description of cluster name",
28
- ).changed
29
- assert not TFConfigDescriptionChange(
30
- block_type=BLOCK_TYPE_VARIABLE,
31
- path=tmp_path,
32
- name="cluster_name",
33
- before="description of cluster name",
34
- after="",
35
- ).changed
36
-
37
-
38
- example_variables_tf = """variable "cluster_name" {
39
- type = string
40
- }
41
- variable "replication_specs" {
42
- description = "List of replication specifications in legacy mongodbatlas_cluster format"
43
- default = []
44
- type = list(object({
45
- num_shards = number
46
- zone_name = string
47
- regions_config = set(object({
48
- region_name = string
49
- electable_nodes = number
50
- priority = number
51
- read_only_nodes = optional(number, 0)
52
- }))
53
- }))
54
- }
55
-
56
- variable "provider_name" {
57
- type = string
58
- default = "" # optional in v3
59
- }
60
- """
61
-
62
-
63
- def test_update_example(tmp_path, file_regression):
64
- base_dir = tmp_path / "example_base"
65
- base_dir.mkdir()
66
- example_variables_tf_path = base_dir / "example_variables.tf"
67
- example_variables_tf_path.write_text(example_variables_tf)
68
- output = update_examples(
69
- UpdateExamples(
70
- examples_base_dir=base_dir,
71
- var_descriptions={
72
- "cluster_name": "description of cluster name",
73
- "replication_specs": "Updated description",
74
- },
75
- )
76
- )
77
- assert output.before_var_descriptions == {
78
- "cluster_name": "",
79
- "provider_name": "",
80
- "replication_specs": "List of replication specifications in legacy mongodbatlas_cluster format",
81
- }
82
- assert len(output.changes) == 3 # noqa: PLR2004
83
- assert [
84
- ("cluster_name", True),
85
- ("provider_name", False),
86
- ("replication_specs", True),
87
- ] == [(change.name, change.changed) for change in output.changes]
88
- file_regression.check(example_variables_tf_path.read_text(), extension=".tf")
89
-
90
-
91
- @pytest.mark.skipif(os.environ.get("TF_FILE", "") == "", reason="needs os.environ[TF_FILE]")
92
- def test_parsing_tf_file():
93
- file = Path(os.environ["TF_FILE"])
94
- assert file.exists()
95
- response, _ = update_descriptions(file, {}, block_type=BLOCK_TYPE_VARIABLE)
96
- assert response
@@ -1,25 +0,0 @@
1
- provider "mongodbatlas" {
2
- public_key = var.public_key
3
- private_key = var.private_key
4
- }
5
-
6
- module "cluster" {
7
- source = "../../module_maintainer/v3"
8
-
9
- cluster_name = var.cluster_name
10
- cluster_type = var.cluster_type
11
- mongo_db_major_version = var.mongo_db_major_version
12
- project_id = var.project_id
13
- replication_specs_new = var.replication_specs_new
14
- tags = var.tags
15
- }
16
-
17
- output "mongodb_connection_strings" {
18
- description = "new connection strings desc"
19
- value = module.cluster.mongodb_connection_strings
20
- }
21
-
22
- output "with_desc" {
23
- value = "with_desc"
24
- description = "description new"
25
- }
@@ -1,24 +0,0 @@
1
- variable "cluster_name" {
2
- description = "description of \"cluster\" name"
3
- type = string
4
- }
5
- variable "replication_specs" {
6
- description = "List of replication specifications in legacy mongodbatlas_cluster format"
7
- default = []
8
- type = list(object({
9
- num_shards = number
10
- zone_name = string
11
- regions_config = set(object({
12
- region_name = string
13
- electable_nodes = number
14
- priority = number
15
- read_only_nodes = optional(number, 0)
16
- }))
17
- }))
18
- }
19
-
20
- variable "provider_name" {
21
- description = "azure/aws/gcp"
22
- type = string
23
- default = ""# optional in v3
24
- }
@@ -1,95 +0,0 @@
1
- import pytest
2
-
3
- from atlas_init.cli_tf.hcl.modifier import BLOCK_TYPE_OUTPUT, BLOCK_TYPE_VARIABLE, update_descriptions
4
-
5
- example_variables_tf = """variable "cluster_name" {
6
- type = string
7
- }
8
- variable "replication_specs" {
9
- description = "List of replication specifications in legacy mongodbatlas_cluster format"
10
- default = []
11
- type = list(object({
12
- num_shards = number
13
- zone_name = string
14
- regions_config = set(object({
15
- region_name = string
16
- electable_nodes = number
17
- priority = number
18
- read_only_nodes = optional(number, 0)
19
- }))
20
- }))
21
- }
22
-
23
- variable "provider_name" {
24
- type = string
25
- default = "" # optional in v3
26
- }
27
- """
28
-
29
- _existing_descriptions_variables = {
30
- "cluster_name": [""],
31
- "provider_name": [""],
32
- "replication_specs": ["List of replication specifications in legacy "],
33
- }
34
-
35
- example_outputs_tf = """provider "mongodbatlas" {
36
- public_key = var.public_key
37
- private_key = var.private_key
38
- }
39
-
40
- module "cluster" {
41
- source = "../../module_maintainer/v3"
42
-
43
- cluster_name = var.cluster_name
44
- cluster_type = var.cluster_type
45
- mongo_db_major_version = var.mongo_db_major_version
46
- project_id = var.project_id
47
- replication_specs_new = var.replication_specs_new
48
- tags = var.tags
49
- }
50
-
51
- output "mongodb_connection_strings" {
52
- value = module.cluster.mongodb_connection_strings
53
- }
54
-
55
- output "with_desc" {
56
- value = "with_desc"
57
- description = "description old"
58
- }
59
- """
60
- _existing_descriptions_outputs = {
61
- "mongodb_connection_strings": [""],
62
- "with_desc": ["description old"],
63
- }
64
-
65
-
66
- @pytest.mark.parametrize(
67
- ("block_type", "new_names", "existing_descriptions", "tf_config"),
68
- [
69
- (
70
- BLOCK_TYPE_VARIABLE,
71
- {
72
- "cluster_name": 'description of "cluster" name',
73
- "provider_name": "azure/aws/gcp",
74
- },
75
- _existing_descriptions_variables,
76
- example_variables_tf,
77
- ),
78
- (
79
- BLOCK_TYPE_OUTPUT,
80
- {
81
- "with_desc": "description new",
82
- "mongodb_connection_strings": "new connection strings desc",
83
- },
84
- _existing_descriptions_outputs,
85
- example_outputs_tf,
86
- ),
87
- ],
88
- ids=[BLOCK_TYPE_VARIABLE, BLOCK_TYPE_OUTPUT],
89
- )
90
- def test_process_variables(tmp_path, file_regression, block_type, new_names, existing_descriptions, tf_config):
91
- example_tf_path = tmp_path / "example.tf"
92
- example_tf_path.write_text(tf_config)
93
- new_tf, existing_descriptions = update_descriptions(example_tf_path, new_names, block_type=block_type)
94
- file_regression.check(new_tf, extension=".tf")
95
- assert dict(existing_descriptions.items()) == existing_descriptions