README.md updated.

master
SLW\ARNAUA 2022-01-11 13:59:23 +01:00
parent 2c8f87b6a3
commit c5efb01320
1 changed files with 21 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# TerraformOnboarding # TerraformOnboarding
The purpose of the exportConfig.py script is to onboard dynatrace services by the help of a custom template. The purpose of the exportConfig.py script is to export dynatrace specific services as terraform files. The importConfig.py script is used to additionally also export the states for each exported terraform file, since terraform does not do that by default.
# Setup # Setup
@ -11,23 +11,35 @@ pip install -r requirements.txt
In order to ensure full functionality a `.env` file is necessary with the following format: In order to ensure full functionality a `.env` file is necessary with the following format:
``` ```yml
# Environment URLs
CN_PREPROD_ENV_URL="https://dynatracemgd-cn.bmwgroup.net/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35" CN_PREPROD_ENV_URL="https://dynatracemgd-cn.bmwgroup.net/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35"
CN_PROD_ENV_URL="https://dynatracemgd-cn.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b" CN_PROD_ENV_URL="https://dynatracemgd-cn.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b"
EMEA_PREPROD_ENV_URL="https://qqk70169.live.dynatrace.com" EMEA_PREPROD_ENV_URL="https://qqk70169.live.dynatrace.com"
EMEA_PROD_ENV_URL="https://xxu26128.live.dynatrace.com" EMEA_PROD_ENV_URL="https://xxu26128.live.dynatrace.com"
NA_PREPROD_ENV_URL="https://onb44935.live.dynatrace.com" NA_PREPROD_ENV_URL="https://onb44935.live.dynatrace.com"
NA_PROD_ENV_URL="https://wgv50241.live.dynatrace.com" NA_PROD_ENV_URL="https://wgv50241.live.dynatrace.com"
# Environment Tokens
CN_PREPROD_API_TOKEN="<your-token>"
CN_PROD_API_TOKEN="<your-token>"
EMEA_PREPROD_API_TOKEN="<your-token>"
EMEA_PROD_API_TOKEN="<your-token>"
NA_PREPROD_API_TOKEN="<your-token>"
NA_PROD_API_TOKEN="<your-token>"
``` ```
Place the `.env` file within the root directory of the project folder: Place the `.env` file within the root directory of the project folder:
```bash ```bash
TerraformOnboarding # Project Folder TerraformDynatrace Porter # Project Folder
├─── _dynatrace-base-modules # Required modules for templates ├─── res
├─── templates # Templates ├─── templates
├─── .env # Add the environment file here ├─── .env # Add the environment file
├─── .gitignore ├─── .gitignore
├─── README.md ├─── README.md
├─── exportConfig.py
├─── imortConfig.py
├─── main.tf
└─── requirements.txt └─── requirements.txt
``` ```
@ -35,16 +47,10 @@ TerraformOnboarding # Project Folder
You can simply run the script by executing the following example command within the projects root directory: You can simply run the script by executing the following example command within the projects root directory:
```python ```python
python onboarding.py <dirname> <tag1,tag2,...> python exportConfig.py
python importConfig.py
``` ```
**Note:** Please note that it is required to delimit the tags by a comma! **Note:** First run the exportConfig.py script and once that is done run the importConfig.py script.
Here is an example command:
```python
python onboarding.py CD_ASBC-PKI-DFP DFP,DFPH
```
In the above example command the directory is going to be created with the name **CD_ASBC-PKI-DFP** within a generated **./output** folder. The key values of the template files will be replaced wit the associated tags delimited by a comma in the shell. The generated files will be stored in subfolders of the **CD_ASBC-PKI-DFP** folder respectively.
# Version # Version