atlas-init 0.1.0__py3-none-any.whl → 0.1.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 +3 -3
- atlas_init/atlas_init.yaml +51 -34
- atlas_init/cli.py +76 -72
- atlas_init/cli_cfn/app.py +40 -117
- atlas_init/cli_cfn/{cfn.py → aws.py} +129 -14
- atlas_init/cli_cfn/cfn_parameter_finder.py +89 -6
- atlas_init/cli_cfn/example.py +203 -0
- atlas_init/cli_cfn/files.py +63 -0
- atlas_init/cli_helper/go.py +6 -3
- atlas_init/cli_helper/run.py +18 -2
- atlas_init/cli_helper/tf_runner.py +12 -21
- atlas_init/cli_root/__init__.py +0 -0
- atlas_init/cli_root/trigger.py +153 -0
- atlas_init/cli_tf/app.py +211 -4
- atlas_init/cli_tf/changelog.py +103 -0
- atlas_init/cli_tf/debug_logs.py +221 -0
- atlas_init/cli_tf/debug_logs_test_data.py +253 -0
- atlas_init/cli_tf/github_logs.py +229 -0
- atlas_init/cli_tf/go_test_run.py +194 -0
- atlas_init/cli_tf/go_test_run_format.py +31 -0
- atlas_init/cli_tf/go_test_summary.py +144 -0
- atlas_init/cli_tf/hcl/__init__.py +0 -0
- atlas_init/cli_tf/hcl/cli.py +161 -0
- atlas_init/cli_tf/hcl/cluster_mig.py +348 -0
- atlas_init/cli_tf/hcl/parser.py +140 -0
- atlas_init/cli_tf/schema.py +222 -18
- atlas_init/cli_tf/schema_go_parser.py +236 -0
- atlas_init/cli_tf/schema_table.py +150 -0
- atlas_init/cli_tf/schema_table_models.py +155 -0
- atlas_init/cli_tf/schema_v2.py +599 -0
- atlas_init/cli_tf/schema_v2_api_parsing.py +298 -0
- atlas_init/cli_tf/schema_v2_sdk.py +361 -0
- atlas_init/cli_tf/schema_v3.py +222 -0
- atlas_init/cli_tf/schema_v3_sdk.py +279 -0
- atlas_init/cli_tf/schema_v3_sdk_base.py +68 -0
- atlas_init/cli_tf/schema_v3_sdk_create.py +216 -0
- atlas_init/humps.py +253 -0
- atlas_init/repos/cfn.py +6 -1
- atlas_init/repos/path.py +3 -3
- atlas_init/settings/config.py +30 -11
- atlas_init/settings/env_vars.py +29 -3
- atlas_init/settings/path.py +12 -1
- atlas_init/settings/rich_utils.py +39 -2
- atlas_init/terraform.yaml +77 -1
- atlas_init/tf/.terraform.lock.hcl +125 -0
- atlas_init/tf/always.tf +11 -2
- atlas_init/tf/main.tf +3 -0
- atlas_init/tf/modules/aws_s3/provider.tf +1 -1
- atlas_init/tf/modules/aws_vars/aws_vars.tf +2 -0
- atlas_init/tf/modules/aws_vpc/provider.tf +4 -1
- atlas_init/tf/modules/cfn/cfn.tf +47 -33
- atlas_init/tf/modules/cfn/kms.tf +54 -0
- atlas_init/tf/modules/cfn/resource_actions.yaml +1 -0
- atlas_init/tf/modules/cfn/variables.tf +31 -0
- atlas_init/tf/modules/cloud_provider/cloud_provider.tf +1 -0
- atlas_init/tf/modules/cloud_provider/provider.tf +1 -1
- atlas_init/tf/modules/cluster/cluster.tf +34 -24
- atlas_init/tf/modules/cluster/provider.tf +1 -1
- atlas_init/tf/modules/federated_vars/federated_vars.tf +3 -0
- atlas_init/tf/modules/federated_vars/provider.tf +1 -1
- atlas_init/tf/modules/project_extra/project_extra.tf +15 -1
- atlas_init/tf/modules/stream_instance/stream_instance.tf +1 -1
- atlas_init/tf/modules/vpc_peering/vpc_peering.tf +1 -1
- atlas_init/tf/modules/vpc_privatelink/versions.tf +1 -1
- atlas_init/tf/outputs.tf +11 -3
- atlas_init/tf/providers.tf +2 -1
- atlas_init/tf/variables.tf +17 -0
- atlas_init/typer_app.py +76 -0
- {atlas_init-0.1.0.dist-info → atlas_init-0.1.4.dist-info}/METADATA +58 -21
- atlas_init-0.1.4.dist-info/RECORD +91 -0
- {atlas_init-0.1.0.dist-info → atlas_init-0.1.4.dist-info}/WHEEL +1 -1
- atlas_init-0.1.0.dist-info/RECORD +0 -61
- /atlas_init/tf/modules/aws_vpc/{aws-vpc.tf → aws_vpc.tf} +0 -0
- {atlas_init-0.1.0.dist-info → atlas_init-0.1.4.dist-info}/entry_points.txt +0 -0
@@ -28,42 +28,51 @@ variable "cloud_backup" {
|
|
28
28
|
|
29
29
|
locals {
|
30
30
|
use_free_cluster = var.instance_size == "M0"
|
31
|
-
cluster = try(
|
32
|
-
container_id = local.cluster.container_id
|
31
|
+
cluster = try(mongodbatlas_advanced_cluster.project_cluster_free[0], mongodbatlas_advanced_cluster.project_cluster[0])
|
32
|
+
container_id = one(values(local.cluster.replication_specs[0].container_id))
|
33
|
+
mongodb_url = "mongodb+srv://${var.mongo_user}:${var.mongo_password}@${replace(local.cluster.connection_strings[0].standard_srv, "mongodb+srv://", "")}/?retryWrites=true"
|
33
34
|
}
|
34
|
-
resource "
|
35
|
+
resource "mongodbatlas_advanced_cluster" "project_cluster_free" {
|
35
36
|
count = local.use_free_cluster ? 1 : 0
|
36
37
|
project_id = var.project_id
|
37
38
|
name = var.cluster_name
|
39
|
+
cluster_type = "REPLICASET"
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
replication_specs {
|
42
|
+
region_configs {
|
43
|
+
auto_scaling {
|
44
|
+
disk_gb_enabled = false
|
45
|
+
}
|
46
|
+
priority = 7
|
47
|
+
provider_name = "TENANT"
|
48
|
+
backing_provider_name = "AWS"
|
49
|
+
region_name = var.region
|
50
|
+
electable_specs {
|
51
|
+
instance_size = var.instance_size
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
43
55
|
}
|
44
56
|
|
45
|
-
resource "
|
57
|
+
resource "mongodbatlas_advanced_cluster" "project_cluster" {
|
46
58
|
count = local.use_free_cluster ? 0 : 1
|
47
59
|
project_id = var.project_id
|
48
60
|
name = var.cluster_name
|
49
|
-
|
61
|
+
backup_enabled = var.cloud_backup
|
50
62
|
cluster_type = "REPLICASET"
|
63
|
+
|
51
64
|
replication_specs {
|
52
|
-
|
53
|
-
regions_config {
|
54
|
-
region_name = var.region
|
55
|
-
electable_nodes = 3
|
65
|
+
region_configs {
|
56
66
|
priority = 7
|
57
|
-
|
67
|
+
provider_name = "AWS"
|
68
|
+
region_name = var.region
|
69
|
+
electable_specs {
|
70
|
+
node_count = 3
|
71
|
+
instance_size = var.instance_size
|
72
|
+
disk_size_gb = 10
|
73
|
+
}
|
58
74
|
}
|
59
75
|
}
|
60
|
-
auto_scaling_disk_gb_enabled = false
|
61
|
-
mongo_db_major_version = "5.0"
|
62
|
-
|
63
|
-
# Provider Settings "block"
|
64
|
-
provider_name = "AWS"
|
65
|
-
disk_size_gb = 10
|
66
|
-
provider_instance_size_name = var.instance_size
|
67
76
|
}
|
68
77
|
|
69
78
|
resource "mongodbatlas_database_user" "mongo-user" {
|
@@ -90,11 +99,11 @@ output "info" {
|
|
90
99
|
sensitive = true
|
91
100
|
value = {
|
92
101
|
standard_srv = local.cluster.connection_strings[0].standard_srv
|
93
|
-
mongo_url =
|
102
|
+
mongo_url = local.mongodb_url
|
94
103
|
mongo_username = var.mongo_user
|
95
104
|
mongo_password = var.mongo_password
|
96
|
-
mongo_url_with_db = "mongodb+srv://${var.mongo_user}:${var.mongo_password}@${replace(local.cluster.
|
97
|
-
cluster_container_id = local.
|
105
|
+
mongo_url_with_db = "mongodb+srv://${var.mongo_user}:${var.mongo_password}@${replace(local.cluster.connection_strings[0].standard_srv, "mongodb+srv://", "")}/${var.db_in_url}?retryWrites=true"
|
106
|
+
cluster_container_id = local.container_id
|
98
107
|
}
|
99
108
|
}
|
100
109
|
|
@@ -102,5 +111,6 @@ output "env_vars" {
|
|
102
111
|
value = {
|
103
112
|
MONGODB_ATLAS_CLUSTER_NAME = var.cluster_name
|
104
113
|
MONGODB_ATLAS_CONTAINER_ID = local.container_id
|
114
|
+
MONGODB_URL = local.mongodb_url
|
105
115
|
}
|
106
116
|
}
|
@@ -35,6 +35,9 @@ output "env_vars" {
|
|
35
35
|
MONGODB_ATLAS_FEDERATION_SETTINGS_ID = var.federated_settings_id
|
36
36
|
MONGODB_ATLAS_FEDERATED_ORG_ID = var.org_id
|
37
37
|
MONGODB_ATLAS_FEDERATED_GROUP_ID = var.project_id
|
38
|
+
MONGODB_ATLAS_FEDERATED_IDP_ID = data.mongodbatlas_federated_settings_org_config.current.identity_provider_id # 20 character legacy needed for PATCH on org
|
39
|
+
# MONGODB_ATLAS_FEDERATED_IDP_ID = data.mongodbatlas_federated_settings_org_config.current.okta_idp_id # used for org PATCH
|
40
|
+
MONGODB_ATLAS_FEDERATED_SETTINGS_ASSOCIATED_DOMAIN = data.mongodbatlas_federated_settings_org_config.current.domain_allow_list[0]
|
38
41
|
}
|
39
42
|
|
40
43
|
}
|
@@ -2,7 +2,7 @@ terraform {
|
|
2
2
|
required_providers {
|
3
3
|
mongodbatlas = {
|
4
4
|
source = "mongodb/mongodbatlas"
|
5
|
-
version = "
|
5
|
+
version = "1.19.0"
|
6
6
|
}
|
7
7
|
}
|
8
8
|
}
|
@@ -35,9 +35,23 @@ resource "mongodbatlas_team" "project_team" {
|
|
35
35
|
usernames = [local.project_user_username]
|
36
36
|
}
|
37
37
|
|
38
|
+
resource "mongodbatlas_team" "project_team2" {
|
39
|
+
org_id = var.org_id
|
40
|
+
name = "tf-test-${var.id_suffix}"
|
41
|
+
usernames = [local.project_user_username]
|
42
|
+
}
|
43
|
+
|
44
|
+
resource "mongodbatlas_team" "project_team3" {
|
45
|
+
org_id = var.org_id
|
46
|
+
name = "tf-test2-${var.id_suffix}"
|
47
|
+
usernames = [local.project_user_username]
|
48
|
+
}
|
49
|
+
|
50
|
+
|
38
51
|
output "env_vars" {
|
39
52
|
value = {
|
40
53
|
MONGODB_ATLAS_TEAM_ID = mongodbatlas_team.project_team.team_id
|
54
|
+
MONGODB_ATLAS_TEAMS_IDS = join(",", [mongodbatlas_team.project_team.team_id, mongodbatlas_team.project_team2.team_id, mongodbatlas_team.project_team3.team_id])
|
41
55
|
MONGODB_ATLAS_ORG_API_KEY_ID = mongodbatlas_api_key.project_key.api_key_id
|
42
56
|
}
|
43
57
|
}
|
atlas_init/tf/outputs.tf
CHANGED
@@ -48,7 +48,9 @@ locals {
|
|
48
48
|
MCLI_ORG_ID = var.org_id
|
49
49
|
MCLI_SKIP_UPDATE_CHECK = "yes"
|
50
50
|
|
51
|
-
PROJECT_NAME
|
51
|
+
PROJECT_NAME = var.project_name
|
52
|
+
MONGODB_ATLAS_PROJECT_OWNER_ID = try(data.mongodbatlas_atlas_user.this[0].user_id, "")
|
53
|
+
|
52
54
|
# tf
|
53
55
|
TF_ACC = 1
|
54
56
|
AWS_ACCOUNT_ID = local.aws_account_id
|
@@ -61,7 +63,9 @@ locals {
|
|
61
63
|
|
62
64
|
output "links" {
|
63
65
|
value = {
|
64
|
-
org_url = "${var.atlas_base_url}v2#/org/${var.org_id}/projects"
|
66
|
+
org_url = "${trimsuffix(var.atlas_base_url, "/")}/v2#/org/${var.org_id}/projects"
|
67
|
+
# https://cloud.mongodb.com/v2/66ad0c5bae611a0fe4387767#/overview
|
68
|
+
project_url = "${trimsuffix(var.atlas_base_url, "/")}/v2/${mongodbatlas_project.project.id}#/overview"
|
65
69
|
}
|
66
70
|
}
|
67
71
|
|
@@ -101,4 +105,8 @@ output "last_provider_version" {
|
|
101
105
|
|
102
106
|
output "aws_account_id" {
|
103
107
|
value = local.aws_account_id
|
104
|
-
}
|
108
|
+
}
|
109
|
+
|
110
|
+
output "my_ip" {
|
111
|
+
value = var.use_project_myip ? chomp(data.http.myip[0].response_body) : null
|
112
|
+
}
|
atlas_init/tf/providers.tf
CHANGED
@@ -2,7 +2,7 @@ terraform {
|
|
2
2
|
required_providers {
|
3
3
|
mongodbatlas = {
|
4
4
|
source = "mongodb/mongodbatlas"
|
5
|
-
version = "1.
|
5
|
+
version = "1.19.0"
|
6
6
|
}
|
7
7
|
aws = {
|
8
8
|
source = "hashicorp/aws"
|
@@ -23,6 +23,7 @@ provider "mongodbatlas" {
|
|
23
23
|
public_key = var.atlas_public_key
|
24
24
|
private_key = var.atlas_private_key
|
25
25
|
base_url = var.atlas_base_url
|
26
|
+
# is_mongodbgov_cloud = var.is_mongodbgov_cloud the base_url takes preference in provider.go
|
26
27
|
}
|
27
28
|
provider "aws" {
|
28
29
|
region = var.aws_region
|
atlas_init/tf/variables.tf
CHANGED
@@ -11,6 +11,16 @@ variable "atlas_base_url" {
|
|
11
11
|
default = "https://cloud-dev.mongodb.com/"
|
12
12
|
}
|
13
13
|
|
14
|
+
variable "user_id" {
|
15
|
+
type = string
|
16
|
+
default = ""
|
17
|
+
}
|
18
|
+
|
19
|
+
variable "is_mongodbgov_cloud" {
|
20
|
+
type = bool
|
21
|
+
default = false
|
22
|
+
}
|
23
|
+
|
14
24
|
variable "federated_settings_id" {
|
15
25
|
type = string
|
16
26
|
default = ""
|
@@ -33,6 +43,11 @@ variable "project_name" {
|
|
33
43
|
}
|
34
44
|
}
|
35
45
|
|
46
|
+
variable "use_project_myip" {
|
47
|
+
type = bool
|
48
|
+
default = false
|
49
|
+
}
|
50
|
+
|
36
51
|
variable "out_dir" {
|
37
52
|
type = string
|
38
53
|
}
|
@@ -41,10 +56,12 @@ variable "cfn_config" {
|
|
41
56
|
type = object({
|
42
57
|
profile = string
|
43
58
|
region = string
|
59
|
+
use_kms_key = bool
|
44
60
|
})
|
45
61
|
default = {
|
46
62
|
profile = ""
|
47
63
|
region = "eu-west-1"
|
64
|
+
use_kms_key = false
|
48
65
|
}
|
49
66
|
}
|
50
67
|
|
atlas_init/typer_app.py
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
import logging
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
from functools import partial
|
5
|
+
|
6
|
+
import typer
|
7
|
+
|
8
|
+
from atlas_init import running_in_repo
|
9
|
+
from atlas_init.cli_cfn.app import app as app_cfn
|
10
|
+
from atlas_init.cli_tf.app import app as app_tf
|
11
|
+
from atlas_init.settings.env_vars import (
|
12
|
+
DEFAULT_PROFILE,
|
13
|
+
AtlasInitSettings,
|
14
|
+
as_env_var_name,
|
15
|
+
env_var_names,
|
16
|
+
)
|
17
|
+
from atlas_init.settings.rich_utils import configure_logging, hide_secrets
|
18
|
+
|
19
|
+
logger = logging.getLogger(__name__)
|
20
|
+
app = typer.Typer(name="atlas_init", invoke_without_command=True, no_args_is_help=True)
|
21
|
+
app.add_typer(app_cfn, name="cfn")
|
22
|
+
app.add_typer(app_tf, name="tf")
|
23
|
+
|
24
|
+
app_command = partial(
|
25
|
+
app.command,
|
26
|
+
context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
|
27
|
+
)
|
28
|
+
|
29
|
+
|
30
|
+
def extra_root_commands():
|
31
|
+
from atlas_init.cli_root import trigger
|
32
|
+
|
33
|
+
assert trigger
|
34
|
+
|
35
|
+
|
36
|
+
@app.callback(invoke_without_command=True)
|
37
|
+
def main(
|
38
|
+
ctx: typer.Context,
|
39
|
+
log_level: str = typer.Option("INFO", help="use one of [INFO, WARNING, ERROR, CRITICAL]"),
|
40
|
+
profile: str = typer.Option(
|
41
|
+
DEFAULT_PROFILE,
|
42
|
+
"-p",
|
43
|
+
"--profile",
|
44
|
+
envvar=env_var_names("profile"),
|
45
|
+
help="used to load .env_manual, store terraform state and variables, and dump .env files.",
|
46
|
+
),
|
47
|
+
project_name: str = typer.Option(
|
48
|
+
"",
|
49
|
+
"--project",
|
50
|
+
envvar=env_var_names("project_name"),
|
51
|
+
help="atlas project name to create",
|
52
|
+
),
|
53
|
+
show_secrets: bool = typer.Option(False, help="show secrets in the logs"),
|
54
|
+
):
|
55
|
+
explicit_env_vars: dict[str, str] = {}
|
56
|
+
if project_name != "":
|
57
|
+
explicit_env_vars[as_env_var_name("project_name")] = project_name
|
58
|
+
log_handler = configure_logging(log_level)
|
59
|
+
logger.info(f"running in repo: {running_in_repo()} python location:{sys.executable}")
|
60
|
+
missing_env_vars, ambiguous_env_vars = AtlasInitSettings.check_env_vars(
|
61
|
+
profile,
|
62
|
+
required_extra_fields=["project_name"],
|
63
|
+
explicit_env_vars=explicit_env_vars,
|
64
|
+
)
|
65
|
+
if missing_env_vars:
|
66
|
+
typer.echo(f"missing env_vars: {missing_env_vars}")
|
67
|
+
if ambiguous_env_vars:
|
68
|
+
typer.echo(
|
69
|
+
f"amiguous env_vars: {missing_env_vars} (specified both in cli & in .env-manual file with different values)"
|
70
|
+
)
|
71
|
+
if missing_env_vars or ambiguous_env_vars:
|
72
|
+
raise typer.Exit(1)
|
73
|
+
if not show_secrets:
|
74
|
+
hide_secrets(log_handler, {**os.environ})
|
75
|
+
command = ctx.invoked_subcommand
|
76
|
+
logger.info(f"in the app callback, log-level: {log_level}, command: {command}")
|
@@ -1,21 +1,23 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: atlas-init
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.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
|
-
License
|
8
|
+
License: MIT
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
10
10
|
Classifier: Programming Language :: Python
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
12
12
|
Requires-Python: >=3.12
|
13
13
|
Requires-Dist: boto3==1.34.55
|
14
14
|
Requires-Dist: gitpython==3.1.42
|
15
|
+
Requires-Dist: humanize==4.9.0
|
15
16
|
Requires-Dist: model-lib==0.0.30
|
16
17
|
Requires-Dist: mypy-boto3-cloudformation==1.34.66
|
17
18
|
Requires-Dist: orjson==3.9.15
|
18
19
|
Requires-Dist: pydantic-settings==2.2.1
|
20
|
+
Requires-Dist: pygithub==2.3.0
|
19
21
|
Requires-Dist: requests==2.31.0
|
20
22
|
Requires-Dist: rich==13.7.1
|
21
23
|
Requires-Dist: stringcase==1.2.0
|
@@ -23,7 +25,21 @@ Requires-Dist: tenacity==8.2.3
|
|
23
25
|
Requires-Dist: typer==0.12.0
|
24
26
|
Description-Content-Type: text/markdown
|
25
27
|
|
26
|
-
# Atlas Init - A CLI for developing with MongoDB Atlas
|
28
|
+
# Atlas Init - A CLI for developing integrations with MongoDB Atlas
|
29
|
+
<p align="center">
|
30
|
+
<a href="https://pypi.org/project/atlas-init/" target="_blank">
|
31
|
+
<img src="https://img.shields.io/pypi/v/atlas-init.svg">
|
32
|
+
</a>
|
33
|
+
<a href="https://pypi.org/project/atlas-init/" target="_blank">
|
34
|
+
<img src="https://img.shields.io/pypi/pyversions/atlas-init.svg">
|
35
|
+
</a>
|
36
|
+
<a href="https://github.com/EspenAlbert/py-libs/blob/main/LICENSE" target="_blank">
|
37
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
|
38
|
+
</a>
|
39
|
+
<a href="https://codecov.io/github/EspenAlbert/atlas-init" target="_blank">
|
40
|
+
<img src="https://codecov.io/github/EspenAlbert/atlas-init/graph/badge.svg?token=DR7FDJXNZY" alt="Coverage">
|
41
|
+
</a>
|
42
|
+
</p>
|
27
43
|
|
28
44
|
Currently, used with
|
29
45
|
- <https://github.com/mongodb/terraform-provider-mongodbatlas>
|
@@ -37,28 +53,29 @@ Currently, used with
|
|
37
53
|
3. create directories and store a file in `profiles/default/.env-manual` (`ATLAS_INIT_PROFILES_PATH/{profile_name}/.env-manual`)
|
38
54
|
|
39
55
|
```env
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
56
|
+
AWS_PROFILE=REPLACE_ME # your AWS profile used to create resources or other env-vars supported by AWS TF provider
|
57
|
+
MONGODB_ATLAS_ORG_ID=REPLACE_ME # ORG_ID_IN_URL_FROM_1
|
58
|
+
MONGODB_ATLAS_PUBLIC_KEY=REPLACE_ME # with 2
|
59
|
+
MONGODB_ATLAS_PRIVATE_KEY=REPLACE_ME # with 2
|
60
|
+
ATLAS_INIT_PROJECT_NAME=YOUR_NAME # the name of the project
|
61
|
+
MONGODB_ATLAS_BASE_URL=https://cloud-dev.mongodb.com/ # replace with https://cloud.mongodb.com/ if you are not a MongoDB Employe
|
46
62
|
|
47
63
|
# optional
|
48
64
|
TF_VAR_federated_settings_id=REPLACE_ME # will need to add organization: <https://cloud-dev.mongodb.com/v2#/federation/{FEDERATION_SETTINGS_ID}/organizations> (see internal testing wiki)
|
49
65
|
|
50
66
|
# if you want to use your locally built MongoDB atlas provider
|
51
67
|
# see appendix for details on the content
|
52
|
-
|
68
|
+
TF_CLI_CONFIG_FILE=REPLACE_ME/dev.tfrc
|
53
69
|
|
54
70
|
# if you plan developing with cloudformation
|
55
|
-
|
56
|
-
|
71
|
+
ATLAS_INIT_CFN_PROFILE=YOUR_NAME
|
72
|
+
ATLAS_INIT_CFN_REGION=eu-south-2 # find a region with few other profiles
|
57
73
|
```
|
58
74
|
|
59
|
-
##
|
75
|
+
## Three modes of running
|
60
76
|
|
61
77
|
### 1. `pip install` normal user
|
78
|
+
|
62
79
|
```shell
|
63
80
|
source .venv/bin/activate # ensure you are in your preferred python env
|
64
81
|
(uv) pip install atlas-init
|
@@ -68,6 +85,8 @@ source .venv/bin/activate # ensure you are in your preferred python env
|
|
68
85
|
### 2. Local development, run from github repo
|
69
86
|
|
70
87
|
```shell
|
88
|
+
git clone https://github.com/EspenAlbert/atlas-init
|
89
|
+
cd atlas-init
|
71
90
|
brew install pre-commit uv hatch
|
72
91
|
# https://github.com/astral-sh/uv <-- python packaging lightning fast
|
73
92
|
# https://hatch.pypa.io/latest/ <-- uv compatible build system for python
|
@@ -76,19 +95,26 @@ pre-commit install
|
|
76
95
|
|
77
96
|
# check that everything works
|
78
97
|
pre-commit run --all-files
|
98
|
+
|
99
|
+
# configure your virtualenv and validate the tests are working
|
79
100
|
cd py
|
80
101
|
hatch test
|
81
|
-
|
82
|
-
|
102
|
+
export VENV_DIR=$(hatch env find hatch-test | grep py3.12) # hatch venv path for env=hatch-test
|
103
|
+
export VENV_PYTHON=$VENV_DIR/bin/python
|
104
|
+
$VENV_PYTHON # ensure you are in shell with python3.12 (cmd+d to exit)
|
105
|
+
cd .. # back to repo root
|
83
106
|
|
84
|
-
# open in your IDE
|
107
|
+
# open in your IDE with virtualenv enabled
|
85
108
|
code .
|
86
|
-
# select venv path from $
|
109
|
+
# select venv path from $VENV_PYTHON output as python interpreter
|
110
|
+
# in vs code: use cmd+p and `Python: select interpreter` command
|
87
111
|
|
88
|
-
# to make it easy to invoke from any terminal
|
89
|
-
export
|
90
|
-
export pypath
|
91
|
-
|
112
|
+
# to make it easy to invoke from any terminal (replace .zprofile with your terminal)
|
113
|
+
export pypath=$(git rev-parse --show-toplevel)/py
|
114
|
+
echo "alias atlas_init='export PYTHONPATH=$pypath && \"$VENV_PYTHON\" -m atlas_init'" >> ~/.zprofile
|
115
|
+
|
116
|
+
# test that it works
|
117
|
+
atlas_init # should show how to use the cli
|
92
118
|
```
|
93
119
|
|
94
120
|
### 3. `pip install` local wheel
|
@@ -117,6 +143,7 @@ atals_init destroy # `terraform destroy`
|
|
117
143
|
|
118
144
|
### Configuring vscode to use your env vars
|
119
145
|
- add to your `settings.json`
|
146
|
+
|
120
147
|
```json
|
121
148
|
{
|
122
149
|
"go.testEnvFile": "/{SOME_PREFIX}/atlas-init/profiles/default/.env-vscode",
|
@@ -140,3 +167,13 @@ provider_installation {
|
|
140
167
|
|
141
168
|
}
|
142
169
|
```
|
170
|
+
|
171
|
+
### Re-generating the lock files
|
172
|
+
|
173
|
+
```shell
|
174
|
+
terraform providers lock \
|
175
|
+
-platform=darwin_amd64 \
|
176
|
+
-platform=linux_amd64 \
|
177
|
+
-platform=darwin_arm64 \
|
178
|
+
-platform=linux_arm64
|
179
|
+
# -platform=windows_amd64 \
|
@@ -0,0 +1,91 @@
|
|
1
|
+
atlas_init/__init__.py,sha256=xD4IVHcbqZz_0_T3O_qEZpsHNAo0ybtN2ktKp5eB3OE,372
|
2
|
+
atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
|
3
|
+
atlas_init/atlas_init.yaml,sha256=GMyJVhKKRc7WzEu7fafmWgeTsDaExTLv7QvXOmE_Brg,1907
|
4
|
+
atlas_init/cli.py,sha256=IiOEC_Jry6vrSDH3_OvsU50F-_3iVIS4tV6-R7659fY,9642
|
5
|
+
atlas_init/cli_args.py,sha256=6ucjRGLGde1XcZIfUCGrWbmQLJB9bWZaXxyAsYXMSSw,427
|
6
|
+
atlas_init/humps.py,sha256=l0ZXXuI34wwd9TskXhCjULfGbUyK-qNmiyC6_2ow6kU,7339
|
7
|
+
atlas_init/terraform.yaml,sha256=qPrnbzBEP-JAQVkYadHsggRnDmshrOJyiv0ckyZCxwY,2734
|
8
|
+
atlas_init/typer_app.py,sha256=irgBK7WSewg7on25KKHY9FNUDvmXgavmc0Z39yhYNjI,2507
|
9
|
+
atlas_init/cli_cfn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
atlas_init/cli_cfn/app.py,sha256=iMukpUDgsAgZh_U_APGZB3gmewOo-3vtFK0byJuDz9w,6649
|
11
|
+
atlas_init/cli_cfn/aws.py,sha256=GbohR7uczSGwQjLEYozCmlxbeIHo1uwQIJMwsh7kF7M,17894
|
12
|
+
atlas_init/cli_cfn/cfn_parameter_finder.py,sha256=tAadNF1M_U2BTY-m9fXVXFXNQRvfudOja97jT3AiVaI,10811
|
13
|
+
atlas_init/cli_cfn/example.py,sha256=pQNpFreuv58O3lanLy5Kunp8GxG8i9PWjuWsYlpv2tg,8320
|
14
|
+
atlas_init/cli_cfn/files.py,sha256=vjop9G8rGMgyRe4fX5eWNX5H-YGAmk-fNUqUGErI7xg,1720
|
15
|
+
atlas_init/cli_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
+
atlas_init/cli_helper/go.py,sha256=LVMXTWvEYOHOul_UG5uQT3QAoL0H1f1O7e4d-11kPrw,1232
|
17
|
+
atlas_init/cli_helper/run.py,sha256=LvzOXFBotGZQ7KZjivr4e7Aq8AUnxy7vGpH1rluSAN8,2988
|
18
|
+
atlas_init/cli_helper/sdk.py,sha256=exh58-VZwxtosaxM269C62EEy1VnpJPOVziPDPkGsmE,2983
|
19
|
+
atlas_init/cli_helper/sdk_auto_changes.py,sha256=oWyXw7P0PdO28hclRvza_RcIVXAyzu0lCYTJTNBDMeo,189
|
20
|
+
atlas_init/cli_helper/tf_runner.py,sha256=OYdC-Y6i-xRh8_LCudKdtP7CEYEO9e67nVhholN29eg,3636
|
21
|
+
atlas_init/cli_root/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
+
atlas_init/cli_root/trigger.py,sha256=oEgqb_l25tyYgUaFHEuChcOCJA7k3mnRa4D-Myz-Igs,5789
|
23
|
+
atlas_init/cli_tf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
atlas_init/cli_tf/app.py,sha256=2lrlbuXPSfgL_k4BeZ4jiWNkRuSemCp5xle1yxCiU4I,11255
|
25
|
+
atlas_init/cli_tf/changelog.py,sha256=biWYKf1pZvXZ-jEgcZ5q9sY7nTGrL2PuI0h9mCILf_g,3181
|
26
|
+
atlas_init/cli_tf/debug_logs.py,sha256=J8MLryNNkRivo2-Z3fnqf5pjPit9xndbsqNSbATTtUg,8047
|
27
|
+
atlas_init/cli_tf/debug_logs_test_data.py,sha256=AOysldCVSBtqW8ZhRnxcOPctng9OodQy0zWWcYbmpoA,8577
|
28
|
+
atlas_init/cli_tf/github_logs.py,sha256=VD7qhlXNuG21eTuJ5VI7rsflp5WHSodfngkRVgQlumw,8114
|
29
|
+
atlas_init/cli_tf/go_test_run.py,sha256=ZoQSvIasmWauFxZJrWL0ObFX-P0k-D3c_ep3OnPY4zs,5842
|
30
|
+
atlas_init/cli_tf/go_test_run_format.py,sha256=OUd6QPHDeTzbwVuh6MhP-xXgjOOGP9W_sCLJ8KylBTs,1201
|
31
|
+
atlas_init/cli_tf/go_test_summary.py,sha256=agr4SITgxchjgOzRpScoTUk-iG38QDLkpnsMtTW9GTY,5382
|
32
|
+
atlas_init/cli_tf/schema.py,sha256=q0RUHb-6ORbQ41u2bZXaWWQLB-xE8Q_O7U1AFq2Gfng,12398
|
33
|
+
atlas_init/cli_tf/schema_go_parser.py,sha256=PiRfFFVnkhltxcGFfOCgH53wwzIEynw2BXmSfaINLL8,8294
|
34
|
+
atlas_init/cli_tf/schema_inspection.py,sha256=ujLvGfg3baByND4nRD0drZoI45STxo3VfYvim-PfVOc,1764
|
35
|
+
atlas_init/cli_tf/schema_table.py,sha256=1i6urBFNVpyopmLbDkYhL3pceKc9NJBCphfVIbm-K6Y,5229
|
36
|
+
atlas_init/cli_tf/schema_table_models.py,sha256=9gS3gYris0MjEWsY_gbLWcZwJokCUJS1TcVXnq7w5SA,5003
|
37
|
+
atlas_init/cli_tf/schema_v2.py,sha256=NtVW3lPKxHtCMBEwo9zThARpy9oQRbsKd0NrhymAyyE,21960
|
38
|
+
atlas_init/cli_tf/schema_v2_api_parsing.py,sha256=8XtwHNU84VPMATD3CbE-TLeVlgxqZggxY5QQ5YjhX4w,12888
|
39
|
+
atlas_init/cli_tf/schema_v2_sdk.py,sha256=AsAERT18FC97Gdb8r-qFInr4pSA15IGMUvCn-065XGE,12630
|
40
|
+
atlas_init/cli_tf/schema_v3.py,sha256=f0m1VoCVukIqyfMee1K-11GfWv_AIKoI4mRAMBYa17k,5769
|
41
|
+
atlas_init/cli_tf/schema_v3_sdk.py,sha256=5RWbhqKT8jEGgJrQaaT7xTRToviIzZZOxuJO5MNLYwo,9929
|
42
|
+
atlas_init/cli_tf/schema_v3_sdk_base.py,sha256=oe7WRZc0R_UYP5Yry4kDAMxOKAUHvQrc9bIdjfLshYk,2131
|
43
|
+
atlas_init/cli_tf/schema_v3_sdk_create.py,sha256=64AluGbQP47RRdY6Cz4KZRN9DdQISW5lLxQ-E1od5dc,8342
|
44
|
+
atlas_init/cli_tf/hcl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
|
+
atlas_init/cli_tf/hcl/cli.py,sha256=6V1kU_a1c4LA3rS7sWN821gQex00fb70AUyd07xO0es,5760
|
46
|
+
atlas_init/cli_tf/hcl/cluster_mig.py,sha256=kMb_0V_XWr_iQj-mZZ-mmzIvYOLfuC4FYGYYSe9VKkQ,12496
|
47
|
+
atlas_init/cli_tf/hcl/parser.py,sha256=NVe55u386U7YSKdT8ZCJ-rPV7O3BgNoyZ_bHsjxGYjQ,4814
|
48
|
+
atlas_init/cloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
|
+
atlas_init/cloud/aws.py,sha256=97kkURWHFAKDIw4704aFmyoeAfQKL11IXMyaQbZUt80,2473
|
50
|
+
atlas_init/repos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
|
+
atlas_init/repos/cfn.py,sha256=rjyVVxRhWL65tdAbEHT72UReK2h99Bj6RA4O2pBO-bc,2466
|
52
|
+
atlas_init/repos/go_sdk.py,sha256=6_ENYMP6yQufo1dXJbLJFDxCuq-8oeTYiGAPC61Uauc,424
|
53
|
+
atlas_init/repos/path.py,sha256=wrT8e01OBoAHj8iMrxqutgqWu-BHPe9-bEWtcZRu238,4187
|
54
|
+
atlas_init/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
|
+
atlas_init/settings/config.py,sha256=HIytZom8RRvpLGy6u8CpZ83tmFXI6v1tO3iSiuo08kc,6259
|
56
|
+
atlas_init/settings/env_vars.py,sha256=B81u9QhWTnkKL6Uzq5KKyJHB8J5btrl-ZBuPAdXUX1A,9146
|
57
|
+
atlas_init/settings/interactive.py,sha256=Xy1Z5WMAOSaJ-vQI_4xjAbSR92rWQgnffwVoDT27L68,340
|
58
|
+
atlas_init/settings/path.py,sha256=rsDeutRlyFkU9ICoRogDdwe8PqryALyyVCJ_0Ssn1ZI,2367
|
59
|
+
atlas_init/settings/rich_utils.py,sha256=fkxd2oKZlVb0dFFcQlJEx7CtxSDUgudjeydVOPDLX5o,1665
|
60
|
+
atlas_init/tf/.terraform.lock.hcl,sha256=DIojR50rr4fyLShYiQ-UpRV8z6vuBjwGWdK60FODoyM,6876
|
61
|
+
atlas_init/tf/always.tf,sha256=ij6QKI8Lg0140bFZwOyiYK5c-2p5e7AGZ1qKbYyv6Os,1359
|
62
|
+
atlas_init/tf/main.tf,sha256=DH0C8y9RDEHnSAZvL-TjE5MQjxj5ALfgk5zVO88cpZw,3960
|
63
|
+
atlas_init/tf/outputs.tf,sha256=Jd1n-rNt0cv-tqXEXaFxJQE7poR_T7FAKEVuhAJd3aE,3857
|
64
|
+
atlas_init/tf/providers.tf,sha256=ayfaz4nekzWzUuH56lZzrJTX1025Wej-xzt0Yi80Uh8,819
|
65
|
+
atlas_init/tf/variables.tf,sha256=2Ioy8O3WZrctndroiyO0D5JQJm2YF5-AMpThJQw75kM,2095
|
66
|
+
atlas_init/tf/modules/aws_s3/aws_s3.tf,sha256=SP5vZf5Y2g9Z5yWpBKSKzEEF5FITPycoGKe-kaHoVCI,738
|
67
|
+
atlas_init/tf/modules/aws_s3/provider.tf,sha256=RmUmMzMfOT5LZIWYqxM2EgtkI7JWqZfj3p3TxZkZoLk,161
|
68
|
+
atlas_init/tf/modules/aws_vars/aws_vars.tf,sha256=0SItDIZUWQCpw4o0y2jZjUY1LnUeUdAL2wOjng3GDtc,508
|
69
|
+
atlas_init/tf/modules/aws_vpc/aws_vpc.tf,sha256=TnWyDFLHi_aYEnqRCNLDjQmCSUPA0x_4A9fCvXL0vO0,1838
|
70
|
+
atlas_init/tf/modules/aws_vpc/provider.tf,sha256=0c2_hW9dSnwbK_1xdD4iSLiD6PACneBx5rEW06uWYlM,210
|
71
|
+
atlas_init/tf/modules/cfn/assume_role_services.yaml,sha256=Sv-FPsLeZ0K_3x0Eq5iJcf7yGe5ax8I0uqzvUlMZDOY,94
|
72
|
+
atlas_init/tf/modules/cfn/cfn.tf,sha256=53zvs0pm_dosX1U666su2FI4fH7CbbelXkgXdN0l8O4,3020
|
73
|
+
atlas_init/tf/modules/cfn/kms.tf,sha256=W-HfFbQ2J1GQC279Ou-PLq4huf0mGn235BCEgO7n9aI,1635
|
74
|
+
atlas_init/tf/modules/cfn/resource_actions.yaml,sha256=rPQZ46YiN-PnpY91hDPOFJgZtlAiyIiyVE3P9yvo50o,540
|
75
|
+
atlas_init/tf/modules/cfn/variables.tf,sha256=qbYffl4ly0K8IRTwG3P7-Yyzm5OBTVRZCmDP69WMp44,379
|
76
|
+
atlas_init/tf/modules/cloud_provider/cloud_provider.tf,sha256=FWExSFKOX239XQaG1AFIRZHQij5NM6sjAWCm3xGDFsQ,1281
|
77
|
+
atlas_init/tf/modules/cloud_provider/provider.tf,sha256=IDpMSLO3GjkxCvF-4qdHugxYq_w-Epujr51HZf_xB0Y,237
|
78
|
+
atlas_init/tf/modules/cluster/cluster.tf,sha256=TId4JsmSDlSHtIzmo3p4GKUVRhzZK9eoiI7DmoYgdq0,3041
|
79
|
+
atlas_init/tf/modules/cluster/provider.tf,sha256=RmUmMzMfOT5LZIWYqxM2EgtkI7JWqZfj3p3TxZkZoLk,161
|
80
|
+
atlas_init/tf/modules/federated_vars/federated_vars.tf,sha256=YTrvDFCHpxwSeoiCOQRB1GdktH3OxFkUVsFYvLhwG2o,1238
|
81
|
+
atlas_init/tf/modules/federated_vars/provider.tf,sha256=RmUmMzMfOT5LZIWYqxM2EgtkI7JWqZfj3p3TxZkZoLk,161
|
82
|
+
atlas_init/tf/modules/project_extra/project_extra.tf,sha256=YkMFLYuAmWd-Hn3afgN3qhdppRLOEL6sStfEN5dOxcc,1512
|
83
|
+
atlas_init/tf/modules/stream_instance/stream_instance.tf,sha256=amajQaIItGgm9YYBPO-h6tLH2E6n8IXPzer2yNx-0Cw,610
|
84
|
+
atlas_init/tf/modules/vpc_peering/vpc_peering.tf,sha256=hJ3KJdGbLpOQednUpVuiJ0CqmUgtfNZrLUGjW4os224,2207
|
85
|
+
atlas_init/tf/modules/vpc_privatelink/atlas-privatelink.tf,sha256=FloaaX1MNDvoMZxBnEopeLKyfIlq6kaX2dmx8WWlXNU,1298
|
86
|
+
atlas_init/tf/modules/vpc_privatelink/variables.tf,sha256=gktHCDYD4rz6CEpLg5aiXcFbugw4L5S2Fqc52QYdJyc,255
|
87
|
+
atlas_init/tf/modules/vpc_privatelink/versions.tf,sha256=G0u5V_Hvvrkux_tqfOY05pA-GzSp_qILpfx1dZaTGDc,237
|
88
|
+
atlas_init-0.1.4.dist-info/METADATA,sha256=ieOVcXrBAAxyEVYz76tbrsqDktFvr3uaXJiATbhsgvk,6167
|
89
|
+
atlas_init-0.1.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
90
|
+
atlas_init-0.1.4.dist-info/entry_points.txt,sha256=6Ycq_NZ7cym1BCA9YiVhYylJzy6woREjt7QSCSLm-1o,54
|
91
|
+
atlas_init-0.1.4.dist-info/RECORD,,
|