atlas-init 0.4.3__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.
- atlas_init/__init__.py +2 -3
- atlas_init/cli.py +2 -1
- atlas_init/cli_cfn/app.py +3 -5
- atlas_init/cli_cfn/cfn_parameter_finder.py +1 -28
- atlas_init/cli_cfn/contract.py +5 -3
- atlas_init/cli_cfn/example.py +8 -6
- atlas_init/cli_helper/go.py +17 -13
- atlas_init/cli_helper/tf_runner.py +14 -11
- atlas_init/cli_root/trigger.py +21 -8
- atlas_init/cli_tf/app.py +1 -1
- atlas_init/cli_tf/github_logs.py +4 -16
- atlas_init/cli_tf/hcl/modifier.py +115 -14
- atlas_init/cli_tf/mock_tf_log.py +3 -2
- atlas_init/cli_tf/schema_v3.py +2 -2
- atlas_init/cli_tf/schema_v3_sdk_base.py +1 -1
- atlas_init/settings/env_vars.py +119 -142
- atlas_init/settings/env_vars_generated.py +40 -9
- atlas_init/settings/env_vars_modules.py +71 -0
- atlas_init/settings/path.py +3 -9
- atlas_init/typer_app.py +3 -3
- {atlas_init-0.4.3.dist-info → atlas_init-0.4.4.dist-info}/METADATA +2 -2
- {atlas_init-0.4.3.dist-info → atlas_init-0.4.4.dist-info}/RECORD +25 -29
- atlas_init/cli_tf/example_update_test/test_update_example.tf +0 -23
- atlas_init/cli_tf/example_update_test.py +0 -96
- atlas_init/cli_tf/hcl/modifier_test/test_process_variables_output_.tf +0 -25
- atlas_init/cli_tf/hcl/modifier_test/test_process_variables_variable_.tf +0 -24
- atlas_init/cli_tf/hcl/modifier_test.py +0 -95
- {atlas_init-0.4.3.dist-info → atlas_init-0.4.4.dist-info}/WHEEL +0 -0
- {atlas_init-0.4.3.dist-info → atlas_init-0.4.4.dist-info}/entry_points.txt +0 -0
- {atlas_init-0.4.3.dist-info → atlas_init-0.4.4.dist-info}/licenses/LICENSE +0 -0
@@ -1,41 +1,40 @@
|
|
1
|
-
atlas_init/__init__.py,sha256=
|
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=
|
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=
|
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=
|
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=
|
13
|
-
atlas_init/cli_cfn/contract.py,sha256=
|
14
|
-
atlas_init/cli_cfn/example.py,sha256=
|
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=
|
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=
|
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=
|
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=
|
27
|
+
atlas_init/cli_tf/app.py,sha256=Y3cAj8XbOT8FESSpVagOuQyfplWSaJPz9lYiigyNj0M,11611
|
28
28
|
atlas_init/cli_tf/changelog.py,sha256=biWYKf1pZvXZ-jEgcZ5q9sY7nTGrL2PuI0h9mCILf_g,3181
|
29
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
32
|
atlas_init/cli_tf/example_update.py,sha256=YctAKZUb932x4VHBI_5T_0jOIbMDYdJaSOVVjJRUMEM,5256
|
33
|
-
atlas_init/cli_tf/
|
34
|
-
atlas_init/cli_tf/github_logs.py,sha256=jJs74npytc7f_nxmUG_CgWpBrKCuF5nZtpwsSii-3XY,8365
|
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=
|
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
|
@@ -44,19 +43,15 @@ atlas_init/cli_tf/schema_table_models.py,sha256=9gS3gYris0MjEWsY_gbLWcZwJokCUJS1
|
|
44
43
|
atlas_init/cli_tf/schema_v2.py,sha256=IKVsyY2wg3SufXi5LPdC6a9FmI4N_8CPZbrnKcwZJcw,21960
|
45
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=
|
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=
|
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=
|
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=
|
69
|
-
atlas_init/settings/env_vars_generated.py,sha256=
|
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=
|
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,8 +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.
|
106
|
-
atlas_init-0.4.
|
107
|
-
atlas_init-0.4.
|
108
|
-
atlas_init-0.4.
|
109
|
-
atlas_init-0.4.
|
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,,
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|