lm-cloud-sync 2.0.0__tar.gz
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.
- lm_cloud_sync-2.0.0/.env.example +67 -0
- lm_cloud_sync-2.0.0/.gitignore +94 -0
- lm_cloud_sync-2.0.0/.python-version +1 -0
- lm_cloud_sync-2.0.0/LICENSE +21 -0
- lm_cloud_sync-2.0.0/PKG-INFO +272 -0
- lm_cloud_sync-2.0.0/README.md +231 -0
- lm_cloud_sync-2.0.0/docs/cli-guide.md +276 -0
- lm_cloud_sync-2.0.0/docs/docker-uv.md +130 -0
- lm_cloud_sync-2.0.0/docs/gcp-spec.md +654 -0
- lm_cloud_sync-2.0.0/docs/lm-cloud-sync-v2-spec.md +1192 -0
- lm_cloud_sync-2.0.0/docs/publishing.md +205 -0
- lm_cloud_sync-2.0.0/docs/python.md +6 -0
- lm_cloud_sync-2.0.0/docs/source-control.md +7 -0
- lm_cloud_sync-2.0.0/docs/using-uv.md +184 -0
- lm_cloud_sync-2.0.0/pyproject.toml +106 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/__init__.py +3 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/cli/__init__.py +5 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/cli/aws.py +388 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/cli/azure.py +385 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/cli/gcp.py +337 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/cli/main.py +191 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/core/__init__.py +40 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/core/config.py +387 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/core/exceptions.py +68 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/core/lm_client.py +208 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/core/models.py +186 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/__init__.py +5 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/aws/__init__.py +6 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/aws/auth.py +125 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/aws/discovery.py +171 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/aws/groups.py +236 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/aws/provider.py +201 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/azure/__init__.py +6 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/azure/discovery.py +183 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/azure/groups.py +241 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/azure/provider.py +220 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/base.py +199 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/gcp/__init__.py +5 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/gcp/discovery.py +165 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/gcp/groups.py +235 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/providers/gcp/provider.py +205 -0
- lm_cloud_sync-2.0.0/src/lm_cloud_sync/py.typed +0 -0
- lm_cloud_sync-2.0.0/terraform/README.md +202 -0
- lm_cloud_sync-2.0.0/terraform/examples/gcp-only/main.tf +37 -0
- lm_cloud_sync-2.0.0/terraform/examples/gcp-only/projects.yaml.example +10 -0
- lm_cloud_sync-2.0.0/terraform/examples/gcp-only/terraform.tfvars.example +7 -0
- lm_cloud_sync-2.0.0/terraform/examples/gcp-only/variables.tf +23 -0
- lm_cloud_sync-2.0.0/terraform/modules/aws/main.tf +79 -0
- lm_cloud_sync-2.0.0/terraform/modules/aws/outputs.tf +11 -0
- lm_cloud_sync-2.0.0/terraform/modules/aws/scripts/create_integration.py +78 -0
- lm_cloud_sync-2.0.0/terraform/modules/aws/scripts/delete_integration.py +53 -0
- lm_cloud_sync-2.0.0/terraform/modules/aws/variables.tf +51 -0
- lm_cloud_sync-2.0.0/terraform/modules/azure/README.md +115 -0
- lm_cloud_sync-2.0.0/terraform/modules/azure/main.tf +98 -0
- lm_cloud_sync-2.0.0/terraform/modules/azure/outputs.tf +63 -0
- lm_cloud_sync-2.0.0/terraform/modules/azure/scripts/export-credentials.sh +43 -0
- lm_cloud_sync-2.0.0/terraform/modules/azure/variables.tf +46 -0
- lm_cloud_sync-2.0.0/terraform/modules/gcp/main.tf +69 -0
- lm_cloud_sync-2.0.0/terraform/modules/gcp/outputs.tf +11 -0
- lm_cloud_sync-2.0.0/terraform/modules/gcp/scripts/create_integration.py +92 -0
- lm_cloud_sync-2.0.0/terraform/modules/gcp/scripts/delete_integration.py +67 -0
- lm_cloud_sync-2.0.0/terraform/modules/gcp/variables.tf +56 -0
- lm_cloud_sync-2.0.0/tests/__init__.py +1 -0
- lm_cloud_sync-2.0.0/tests/conftest.py +58 -0
- lm_cloud_sync-2.0.0/tests/integration/__init__.py +1 -0
- lm_cloud_sync-2.0.0/tests/unit/__init__.py +1 -0
- lm_cloud_sync-2.0.0/tests/unit/test_aws_auth.py +119 -0
- lm_cloud_sync-2.0.0/tests/unit/test_aws_discovery.py +262 -0
- lm_cloud_sync-2.0.0/tests/unit/test_aws_groups.py +203 -0
- lm_cloud_sync-2.0.0/tests/unit/test_azure_discovery.py +187 -0
- lm_cloud_sync-2.0.0/tests/unit/test_azure_groups.py +211 -0
- lm_cloud_sync-2.0.0/tests/unit/test_cli.py +69 -0
- lm_cloud_sync-2.0.0/tests/unit/test_lm_client.py +150 -0
- lm_cloud_sync-2.0.0/tests/unit/test_models.py +154 -0
- lm_cloud_sync-2.0.0/uv.lock +1682 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# LogicMonitor Configuration
|
|
2
|
+
# Required for all cloud providers
|
|
3
|
+
LM_COMPANY=your-company-name
|
|
4
|
+
LM_BEARER_TOKEN=lmb_your_bearer_token_here
|
|
5
|
+
|
|
6
|
+
# Alternative: LMv1 Authentication (use instead of bearer token)
|
|
7
|
+
# LM_ACCESS_ID=your_access_id
|
|
8
|
+
# LM_ACCESS_KEY=your_access_key
|
|
9
|
+
|
|
10
|
+
# ============================================================================
|
|
11
|
+
# GCP Configuration
|
|
12
|
+
# ============================================================================
|
|
13
|
+
|
|
14
|
+
# Path to GCP service account key JSON file
|
|
15
|
+
# The service account needs 'roles/viewer' or 'roles/resourcemanager.projectViewer'
|
|
16
|
+
# at the organization or folder level for auto-discovery
|
|
17
|
+
GCP_SA_KEY_PATH=/path/to/gcp-service-account-key.json
|
|
18
|
+
|
|
19
|
+
# Alternative: Use Google Application Default Credentials
|
|
20
|
+
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/gcp-service-account-key.json
|
|
21
|
+
|
|
22
|
+
# Optional: GCP project ID for API calls (usually auto-detected)
|
|
23
|
+
# GCP_PROJECT_ID=your-gcp-project-id
|
|
24
|
+
|
|
25
|
+
# ============================================================================
|
|
26
|
+
# AWS Configuration
|
|
27
|
+
# ============================================================================
|
|
28
|
+
|
|
29
|
+
# AWS credentials for accessing Organizations API
|
|
30
|
+
# The credentials need 'organizations:ListAccounts' permission on the management account
|
|
31
|
+
AWS_ACCESS_KEY_ID=your_aws_access_key_id
|
|
32
|
+
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
|
|
33
|
+
|
|
34
|
+
# Optional: AWS session token (for temporary credentials)
|
|
35
|
+
# AWS_SESSION_TOKEN=your_session_token
|
|
36
|
+
|
|
37
|
+
# Optional: AWS region (defaults to us-east-1)
|
|
38
|
+
# AWS_DEFAULT_REGION=us-east-1
|
|
39
|
+
|
|
40
|
+
# Optional: AWS profile name (if using ~/.aws/credentials)
|
|
41
|
+
# AWS_PROFILE=default
|
|
42
|
+
|
|
43
|
+
# ============================================================================
|
|
44
|
+
# Azure Configuration
|
|
45
|
+
# ============================================================================
|
|
46
|
+
|
|
47
|
+
# Azure Service Principal credentials
|
|
48
|
+
# The service principal needs 'Reader' role at subscription or management group level
|
|
49
|
+
AZURE_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
50
|
+
AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
51
|
+
AZURE_CLIENT_SECRET=your_azure_client_secret
|
|
52
|
+
|
|
53
|
+
# Optional: Specific subscription ID (if not using auto-discovery)
|
|
54
|
+
# AZURE_SUBSCRIPTION_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
55
|
+
|
|
56
|
+
# ============================================================================
|
|
57
|
+
# Additional Configuration
|
|
58
|
+
# ============================================================================
|
|
59
|
+
|
|
60
|
+
# Optional: Path to config file (default: config.yaml in current directory)
|
|
61
|
+
# LM_CLOUD_SYNC_CONFIG=/path/to/config.yaml
|
|
62
|
+
|
|
63
|
+
# Optional: Enable verbose logging
|
|
64
|
+
# LM_CLOUD_SYNC_VERBOSE=true
|
|
65
|
+
|
|
66
|
+
# Optional: Log level (DEBUG, INFO, WARNING, ERROR)
|
|
67
|
+
# LM_CLOUD_SYNC_LOG_LEVEL=INFO
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
|
|
29
|
+
# uv
|
|
30
|
+
.uv/
|
|
31
|
+
|
|
32
|
+
# IDE
|
|
33
|
+
.idea/
|
|
34
|
+
.vscode/
|
|
35
|
+
*.swp
|
|
36
|
+
*.swo
|
|
37
|
+
*~
|
|
38
|
+
|
|
39
|
+
# Testing
|
|
40
|
+
.pytest_cache/
|
|
41
|
+
.coverage
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
|
|
46
|
+
# mypy
|
|
47
|
+
.mypy_cache/
|
|
48
|
+
.dmypy.json
|
|
49
|
+
dmypy.json
|
|
50
|
+
|
|
51
|
+
# ruff
|
|
52
|
+
.ruff_cache/
|
|
53
|
+
|
|
54
|
+
# Environment and secrets
|
|
55
|
+
.env
|
|
56
|
+
.env.*
|
|
57
|
+
!.env.example
|
|
58
|
+
*.env
|
|
59
|
+
|
|
60
|
+
# Service account keys
|
|
61
|
+
*.json
|
|
62
|
+
!package.json
|
|
63
|
+
!tsconfig.json
|
|
64
|
+
|
|
65
|
+
# Local configuration
|
|
66
|
+
config.local.yaml
|
|
67
|
+
config.local.yml
|
|
68
|
+
*.local.yaml
|
|
69
|
+
*.local.yml
|
|
70
|
+
|
|
71
|
+
# macOS
|
|
72
|
+
.DS_Store
|
|
73
|
+
.AppleDouble
|
|
74
|
+
.LSOverride
|
|
75
|
+
|
|
76
|
+
# Claude and LLM files
|
|
77
|
+
.claude/
|
|
78
|
+
.claude*
|
|
79
|
+
CLAUDE.md
|
|
80
|
+
CLAUDE.local.md
|
|
81
|
+
|
|
82
|
+
# Logs
|
|
83
|
+
*.log
|
|
84
|
+
logs/
|
|
85
|
+
|
|
86
|
+
# Terraform
|
|
87
|
+
*.tfstate
|
|
88
|
+
*.tfstate.*
|
|
89
|
+
.terraform/
|
|
90
|
+
.terraform.lock.hcl
|
|
91
|
+
terraform.tfvars
|
|
92
|
+
!terraform.tfvars.example
|
|
93
|
+
*.tfvars
|
|
94
|
+
!*.tfvars.example
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ryan Matuszewski
|
|
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.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lm-cloud-sync
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Multi-cloud automation tool for LogicMonitor integrations. GCP support in v2.0, AWS/Azure coming soon.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ryanmat/lm-cloud-sync
|
|
6
|
+
Project-URL: Repository, https://github.com/ryanmat/lm-cloud-sync
|
|
7
|
+
Project-URL: Issues, https://github.com/ryanmat/lm-cloud-sync/issues
|
|
8
|
+
Author-email: Ryan Matuszewski <rmmatuszewski@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: automation,aws,azure,cloud,gcp,logicmonitor,monitoring
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: System :: Monitoring
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: azure-identity>=1.15.0
|
|
23
|
+
Requires-Dist: azure-mgmt-subscription>=3.1.0
|
|
24
|
+
Requires-Dist: boto3>=1.34.0
|
|
25
|
+
Requires-Dist: click>=8.1.0
|
|
26
|
+
Requires-Dist: google-auth>=2.20.0
|
|
27
|
+
Requires-Dist: google-cloud-resource-manager>=1.10.0
|
|
28
|
+
Requires-Dist: httpx>=0.27.0
|
|
29
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
30
|
+
Requires-Dist: pydantic>=2.0.0
|
|
31
|
+
Requires-Dist: pyyaml>=6.0
|
|
32
|
+
Requires-Dist: rich>=13.0.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: moto[organizations]>=5.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: mypy>=1.10.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# LM Cloud Sync
|
|
43
|
+
|
|
44
|
+
Multi-cloud automation tool for LogicMonitor integrations.
|
|
45
|
+
|
|
46
|
+
Automatically discover and sync cloud resources (AWS accounts, Azure subscriptions, GCP projects) to LogicMonitor as device groups.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **GCP Support** (v2.0.0): Full support for Google Cloud Platform
|
|
51
|
+
- Auto-discovery using Resource Manager API
|
|
52
|
+
- Project-level integration management
|
|
53
|
+
- Dry-run mode and orphan detection
|
|
54
|
+
- **Coming Soon**: AWS and Azure support (in development)
|
|
55
|
+
- **CLI & Terraform**: Deploy via command line or infrastructure-as-code
|
|
56
|
+
- **Flexible Authentication**: Bearer token or LMv1 auth
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
### From Source (Current)
|
|
61
|
+
|
|
62
|
+
This package is not yet published to PyPI. Install from source:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Clone the repository
|
|
66
|
+
git clone https://github.com/ryanmat/lm-cloud-sync.git
|
|
67
|
+
cd lm-cloud-sync
|
|
68
|
+
|
|
69
|
+
# Option 1: Run directly with uv (recommended for development)
|
|
70
|
+
uv run lm-cloud-sync --help
|
|
71
|
+
|
|
72
|
+
# Option 2: Install in virtual environment
|
|
73
|
+
uv venv
|
|
74
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
75
|
+
uv pip install -e .
|
|
76
|
+
lm-cloud-sync --help
|
|
77
|
+
|
|
78
|
+
# Option 3: Install as a tool globally
|
|
79
|
+
uv tool install --editable .
|
|
80
|
+
lm-cloud-sync --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### From PyPI (Coming Soon)
|
|
84
|
+
|
|
85
|
+
Once published, you'll be able to install via:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Using uv
|
|
89
|
+
uv tool install lm-cloud-sync
|
|
90
|
+
|
|
91
|
+
# Or using pip
|
|
92
|
+
pip install lm-cloud-sync
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
### 1. Set Up Environment Variables
|
|
98
|
+
|
|
99
|
+
Create a `.env` file in your project root (or set environment variables):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Copy the example file
|
|
103
|
+
cp .env.example .env
|
|
104
|
+
|
|
105
|
+
# Edit .env with your credentials
|
|
106
|
+
# LogicMonitor (required for all providers)
|
|
107
|
+
LM_COMPANY=your-company-name
|
|
108
|
+
LM_BEARER_TOKEN=your-bearer-token
|
|
109
|
+
|
|
110
|
+
# GCP (if using GCP provider)
|
|
111
|
+
GCP_SA_KEY_PATH=/path/to/service-account.json
|
|
112
|
+
|
|
113
|
+
# AWS (if using AWS provider)
|
|
114
|
+
AWS_ACCESS_KEY_ID=your-access-key
|
|
115
|
+
AWS_SECRET_ACCESS_KEY=your-secret-key
|
|
116
|
+
|
|
117
|
+
# Azure (if using Azure provider)
|
|
118
|
+
AZURE_TENANT_ID=your-tenant-id
|
|
119
|
+
AZURE_CLIENT_ID=your-client-id
|
|
120
|
+
AZURE_CLIENT_SECRET=your-client-secret
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 2. Discover GCP Projects
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Discover GCP projects
|
|
127
|
+
lm-cloud-sync gcp discover
|
|
128
|
+
|
|
129
|
+
# With auto-discovery (org-level)
|
|
130
|
+
lm-cloud-sync gcp discover --auto-discover
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 3. Check Sync Status
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Check what's already synced vs what needs to be added
|
|
137
|
+
lm-cloud-sync gcp status
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 4. Preview Changes (Dry Run)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# See what would be created without making changes
|
|
144
|
+
lm-cloud-sync gcp sync --dry-run
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 5. Execute Sync
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Create integrations in LogicMonitor
|
|
151
|
+
lm-cloud-sync gcp sync --yes
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## CLI Commands
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
lm-cloud-sync
|
|
158
|
+
├── gcp # GCP support (v2.0.0)
|
|
159
|
+
│ ├── discover # List GCP projects
|
|
160
|
+
│ ├── status # Show sync status
|
|
161
|
+
│ ├── sync # Sync projects to LM
|
|
162
|
+
│ └── delete # Delete an integration
|
|
163
|
+
├── aws # Coming in v2.1.0
|
|
164
|
+
├── azure # Coming in v2.2.0
|
|
165
|
+
├── all # Multi-cloud sync (future)
|
|
166
|
+
└── config
|
|
167
|
+
├── init # Create config file
|
|
168
|
+
└── validate # Validate config
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Common Options
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Discover with auto-discovery (org-level)
|
|
175
|
+
lm-cloud-sync gcp discover --auto-discover
|
|
176
|
+
|
|
177
|
+
# Sync with dry-run
|
|
178
|
+
lm-cloud-sync gcp sync --dry-run
|
|
179
|
+
|
|
180
|
+
# Sync and delete orphaned integrations
|
|
181
|
+
lm-cloud-sync gcp sync --delete-orphans --yes
|
|
182
|
+
|
|
183
|
+
# Check status with orphan detection
|
|
184
|
+
lm-cloud-sync gcp status --show-orphans
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
### Environment Variables (v2.0.0)
|
|
190
|
+
|
|
191
|
+
**Required:**
|
|
192
|
+
| Variable | Description |
|
|
193
|
+
|----------|-------------|
|
|
194
|
+
| `LM_COMPANY` | LogicMonitor portal name |
|
|
195
|
+
| `LM_BEARER_TOKEN` | Bearer token for auth* |
|
|
196
|
+
| `GCP_SA_KEY_PATH` | Path to GCP service account JSON |
|
|
197
|
+
|
|
198
|
+
*Or use `LM_ACCESS_ID` and `LM_ACCESS_KEY` for LMv1 authentication.
|
|
199
|
+
|
|
200
|
+
See [.env.example](.env.example) for additional configuration options and future provider support (AWS, Azure).
|
|
201
|
+
|
|
202
|
+
### Configuration File
|
|
203
|
+
|
|
204
|
+
Create a config file with `lm-cloud-sync config init`:
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
logicmonitor:
|
|
208
|
+
company: "your-company"
|
|
209
|
+
|
|
210
|
+
gcp:
|
|
211
|
+
enabled: true
|
|
212
|
+
filters:
|
|
213
|
+
exclude_patterns: ["sys-*", "test-*"]
|
|
214
|
+
regions:
|
|
215
|
+
- us-central1
|
|
216
|
+
- us-east1
|
|
217
|
+
services:
|
|
218
|
+
- COMPUTEENGINE
|
|
219
|
+
- CLOUDSQL
|
|
220
|
+
|
|
221
|
+
sync:
|
|
222
|
+
dry_run: false
|
|
223
|
+
delete_orphans: false
|
|
224
|
+
custom_properties:
|
|
225
|
+
"lm.cloud.managed_by": "lm-cloud-sync"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Terraform
|
|
229
|
+
|
|
230
|
+
See [terraform/](./terraform/) for Terraform modules.
|
|
231
|
+
|
|
232
|
+
```hcl
|
|
233
|
+
module "gcp_integration" {
|
|
234
|
+
source = "github.com/ryanmat/lm-cloud-sync//terraform/modules/gcp"
|
|
235
|
+
|
|
236
|
+
lm_company = "your-company"
|
|
237
|
+
lm_bearer_token = var.lm_bearer_token
|
|
238
|
+
gcp_project_id = "my-project"
|
|
239
|
+
gcp_sa_key_path = "/path/to/key.json"
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Development
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Clone the repository
|
|
247
|
+
git clone https://github.com/ryanmat/lm-cloud-sync.git
|
|
248
|
+
cd lm-cloud-sync
|
|
249
|
+
|
|
250
|
+
# Install dependencies
|
|
251
|
+
uv sync --all-extras
|
|
252
|
+
|
|
253
|
+
# Run tests
|
|
254
|
+
uv run pytest
|
|
255
|
+
|
|
256
|
+
# Run linting
|
|
257
|
+
uv run ruff check src/
|
|
258
|
+
|
|
259
|
+
# Run the CLI
|
|
260
|
+
uv run lm-cloud-sync --help
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Roadmap
|
|
264
|
+
|
|
265
|
+
- [x] **v2.0.0**: GCP support (current release)
|
|
266
|
+
- [ ] **v2.1.0**: AWS support with Organizations discovery
|
|
267
|
+
- [ ] **v2.2.0**: Azure support with Management API discovery
|
|
268
|
+
- [ ] **v3.0.0**: Multi-cloud sync (`lm-cloud-sync all`)
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# LM Cloud Sync
|
|
2
|
+
|
|
3
|
+
Multi-cloud automation tool for LogicMonitor integrations.
|
|
4
|
+
|
|
5
|
+
Automatically discover and sync cloud resources (AWS accounts, Azure subscriptions, GCP projects) to LogicMonitor as device groups.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **GCP Support** (v2.0.0): Full support for Google Cloud Platform
|
|
10
|
+
- Auto-discovery using Resource Manager API
|
|
11
|
+
- Project-level integration management
|
|
12
|
+
- Dry-run mode and orphan detection
|
|
13
|
+
- **Coming Soon**: AWS and Azure support (in development)
|
|
14
|
+
- **CLI & Terraform**: Deploy via command line or infrastructure-as-code
|
|
15
|
+
- **Flexible Authentication**: Bearer token or LMv1 auth
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### From Source (Current)
|
|
20
|
+
|
|
21
|
+
This package is not yet published to PyPI. Install from source:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Clone the repository
|
|
25
|
+
git clone https://github.com/ryanmat/lm-cloud-sync.git
|
|
26
|
+
cd lm-cloud-sync
|
|
27
|
+
|
|
28
|
+
# Option 1: Run directly with uv (recommended for development)
|
|
29
|
+
uv run lm-cloud-sync --help
|
|
30
|
+
|
|
31
|
+
# Option 2: Install in virtual environment
|
|
32
|
+
uv venv
|
|
33
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
34
|
+
uv pip install -e .
|
|
35
|
+
lm-cloud-sync --help
|
|
36
|
+
|
|
37
|
+
# Option 3: Install as a tool globally
|
|
38
|
+
uv tool install --editable .
|
|
39
|
+
lm-cloud-sync --help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### From PyPI (Coming Soon)
|
|
43
|
+
|
|
44
|
+
Once published, you'll be able to install via:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Using uv
|
|
48
|
+
uv tool install lm-cloud-sync
|
|
49
|
+
|
|
50
|
+
# Or using pip
|
|
51
|
+
pip install lm-cloud-sync
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
### 1. Set Up Environment Variables
|
|
57
|
+
|
|
58
|
+
Create a `.env` file in your project root (or set environment variables):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Copy the example file
|
|
62
|
+
cp .env.example .env
|
|
63
|
+
|
|
64
|
+
# Edit .env with your credentials
|
|
65
|
+
# LogicMonitor (required for all providers)
|
|
66
|
+
LM_COMPANY=your-company-name
|
|
67
|
+
LM_BEARER_TOKEN=your-bearer-token
|
|
68
|
+
|
|
69
|
+
# GCP (if using GCP provider)
|
|
70
|
+
GCP_SA_KEY_PATH=/path/to/service-account.json
|
|
71
|
+
|
|
72
|
+
# AWS (if using AWS provider)
|
|
73
|
+
AWS_ACCESS_KEY_ID=your-access-key
|
|
74
|
+
AWS_SECRET_ACCESS_KEY=your-secret-key
|
|
75
|
+
|
|
76
|
+
# Azure (if using Azure provider)
|
|
77
|
+
AZURE_TENANT_ID=your-tenant-id
|
|
78
|
+
AZURE_CLIENT_ID=your-client-id
|
|
79
|
+
AZURE_CLIENT_SECRET=your-client-secret
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Discover GCP Projects
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Discover GCP projects
|
|
86
|
+
lm-cloud-sync gcp discover
|
|
87
|
+
|
|
88
|
+
# With auto-discovery (org-level)
|
|
89
|
+
lm-cloud-sync gcp discover --auto-discover
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 3. Check Sync Status
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Check what's already synced vs what needs to be added
|
|
96
|
+
lm-cloud-sync gcp status
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 4. Preview Changes (Dry Run)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# See what would be created without making changes
|
|
103
|
+
lm-cloud-sync gcp sync --dry-run
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 5. Execute Sync
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Create integrations in LogicMonitor
|
|
110
|
+
lm-cloud-sync gcp sync --yes
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## CLI Commands
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
lm-cloud-sync
|
|
117
|
+
├── gcp # GCP support (v2.0.0)
|
|
118
|
+
│ ├── discover # List GCP projects
|
|
119
|
+
│ ├── status # Show sync status
|
|
120
|
+
│ ├── sync # Sync projects to LM
|
|
121
|
+
│ └── delete # Delete an integration
|
|
122
|
+
├── aws # Coming in v2.1.0
|
|
123
|
+
├── azure # Coming in v2.2.0
|
|
124
|
+
├── all # Multi-cloud sync (future)
|
|
125
|
+
└── config
|
|
126
|
+
├── init # Create config file
|
|
127
|
+
└── validate # Validate config
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Common Options
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Discover with auto-discovery (org-level)
|
|
134
|
+
lm-cloud-sync gcp discover --auto-discover
|
|
135
|
+
|
|
136
|
+
# Sync with dry-run
|
|
137
|
+
lm-cloud-sync gcp sync --dry-run
|
|
138
|
+
|
|
139
|
+
# Sync and delete orphaned integrations
|
|
140
|
+
lm-cloud-sync gcp sync --delete-orphans --yes
|
|
141
|
+
|
|
142
|
+
# Check status with orphan detection
|
|
143
|
+
lm-cloud-sync gcp status --show-orphans
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Configuration
|
|
147
|
+
|
|
148
|
+
### Environment Variables (v2.0.0)
|
|
149
|
+
|
|
150
|
+
**Required:**
|
|
151
|
+
| Variable | Description |
|
|
152
|
+
|----------|-------------|
|
|
153
|
+
| `LM_COMPANY` | LogicMonitor portal name |
|
|
154
|
+
| `LM_BEARER_TOKEN` | Bearer token for auth* |
|
|
155
|
+
| `GCP_SA_KEY_PATH` | Path to GCP service account JSON |
|
|
156
|
+
|
|
157
|
+
*Or use `LM_ACCESS_ID` and `LM_ACCESS_KEY` for LMv1 authentication.
|
|
158
|
+
|
|
159
|
+
See [.env.example](.env.example) for additional configuration options and future provider support (AWS, Azure).
|
|
160
|
+
|
|
161
|
+
### Configuration File
|
|
162
|
+
|
|
163
|
+
Create a config file with `lm-cloud-sync config init`:
|
|
164
|
+
|
|
165
|
+
```yaml
|
|
166
|
+
logicmonitor:
|
|
167
|
+
company: "your-company"
|
|
168
|
+
|
|
169
|
+
gcp:
|
|
170
|
+
enabled: true
|
|
171
|
+
filters:
|
|
172
|
+
exclude_patterns: ["sys-*", "test-*"]
|
|
173
|
+
regions:
|
|
174
|
+
- us-central1
|
|
175
|
+
- us-east1
|
|
176
|
+
services:
|
|
177
|
+
- COMPUTEENGINE
|
|
178
|
+
- CLOUDSQL
|
|
179
|
+
|
|
180
|
+
sync:
|
|
181
|
+
dry_run: false
|
|
182
|
+
delete_orphans: false
|
|
183
|
+
custom_properties:
|
|
184
|
+
"lm.cloud.managed_by": "lm-cloud-sync"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Terraform
|
|
188
|
+
|
|
189
|
+
See [terraform/](./terraform/) for Terraform modules.
|
|
190
|
+
|
|
191
|
+
```hcl
|
|
192
|
+
module "gcp_integration" {
|
|
193
|
+
source = "github.com/ryanmat/lm-cloud-sync//terraform/modules/gcp"
|
|
194
|
+
|
|
195
|
+
lm_company = "your-company"
|
|
196
|
+
lm_bearer_token = var.lm_bearer_token
|
|
197
|
+
gcp_project_id = "my-project"
|
|
198
|
+
gcp_sa_key_path = "/path/to/key.json"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Development
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Clone the repository
|
|
206
|
+
git clone https://github.com/ryanmat/lm-cloud-sync.git
|
|
207
|
+
cd lm-cloud-sync
|
|
208
|
+
|
|
209
|
+
# Install dependencies
|
|
210
|
+
uv sync --all-extras
|
|
211
|
+
|
|
212
|
+
# Run tests
|
|
213
|
+
uv run pytest
|
|
214
|
+
|
|
215
|
+
# Run linting
|
|
216
|
+
uv run ruff check src/
|
|
217
|
+
|
|
218
|
+
# Run the CLI
|
|
219
|
+
uv run lm-cloud-sync --help
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Roadmap
|
|
223
|
+
|
|
224
|
+
- [x] **v2.0.0**: GCP support (current release)
|
|
225
|
+
- [ ] **v2.1.0**: AWS support with Organizations discovery
|
|
226
|
+
- [ ] **v2.2.0**: Azure support with Management API discovery
|
|
227
|
+
- [ ] **v3.0.0**: Multi-cloud sync (`lm-cloud-sync all`)
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT License - see [LICENSE](./LICENSE) for details.
|