Takes an existing EchoStream Tenant and creates a Terraform script and statefile for it
Project description
echostream-terrafy
EchoStream provides a graphical way to design, build and update processing and integration networks in real time.
However, there are teams that wish to manage all resources (EchoStream and others, such as Azure or AWS) in Infrastructure as Code (IaC). If you have designed a large network of processing resource in EchoStream, the ideal solution would be to introspect and extract those resources into Terraform scripts.
echostream-terrafy is the tool that does this, creating:
- A set of Terraform scripts in HCL JSON format that exactly matches the current state of your Tenant. These may be used as-is or may be converted into a module for use in a larger Terraform script.
- A
terraform.tfstatefile that has all of the resources in the Terraform scripts imported.
Installation
echostream-terrafy is a Python package that provides an executable. To install it:
- Install Python >= 3.9 for your device.
- Install your preferred HCL client.
-
Install Terraform >= 1.5.7 for your device.
Warning - if you do not install Terraform to a location in your PATH, make note of the installation location!
-OR-
-
Install OpenTofu >= 1.6.2 for your device.
Warning - if you do not install OponTofu to a location in your PATH, make note of the installation location!
-
- Install
echostream-terrafy.- Using pipx - RECOMMENDED
pipx install echostream-terrafy
- Using pip
- Create a Python virtual environment for the
echostream-terrafyinstallation.python -m venv echostream-terrafy
- Activate the virtual environment and install
echostream-terrafyinto it.source echostream-terrafy/bin/activate pip install echostream-terrafy
Note - to deactivate the virtual environment, simply type
deactivateat the command prompt.
- Create a Python virtual environment for the
- Using pipx - RECOMMENDED
Usage
In your EchoStream Tenant, create an ApiUser with the admin role.
Make note of the following in your ApiUser's credentials:
- GraphQL Appsync Endpoint
- Client Id
- Username
- Password
- User Pool Id
You may execute echostream-terrafy using either environment variables, command-line parameters, or a combination of both. If a parameter is present in both the environment and on the command line, the command line takes precedence.
All output from echostream-terrafy executions will be written to the current working directory, with existing files (including the terraform.tfstate file) being overwritten.
Note - it is recommended that you create a directory for the output of
echostream-terrafyand execute it within that directory.
Warning - if you did not install
terraformortofuinto your PATH, you must letechostream-terrafyknow where to find it. This may be accomplished by specifying the--clicommand-line parameter with the full path to theterraformortofuexecutable.
Warning - while the EchoStream Terraform Provider will run in a non-POSIX environment (e.g. - Windows),
echostream-terrafywill NOT generate correct paths in a non-POSIX environment. Path construction is OS dependent. Because of this,echostream-terrafywill not run in a non-POSIX envrionment.
Executing with environment variables
source echostream-terrafy/bin/activate # OPTIONAL - for use with venv
export ECHOSTREAM_APPSYNC_ENDPOINT=<api_user_appsync_endpoint>
export ECHOSTREAM_CLIENT_ID=<api_user_client_id>
export ECHOSTREAM_PASSWORD=<api_user_password>
export ECHOSTREAM_TENANT=<my_tenant_name>
export ECHOSTREAM_USER_POOL_ID=<api_user_user_pool_id>
export ECHOSTREAM_USERNAME=<api_user_username>
echostream-terrafy
deactivate # OPTIONAL - for use with venv
Executing using command-line variables
source echostream-terrafy/bin/activate # OPTIONAL - for use with venv
echostream-terrafy \
--appsync-endpoint <api_user_appsync_endpoint> \
--client-id <api_user_client_id> \
--password <api_user_password> \
--tenant <my_tenant_name> \
--user-pool-id <api_user_user_pool_id> \
--username <api_user_username>
deactivate # OPTIONAL - for use with venv
Output
echostream-terrafy will generate the following files.
| Filename | Content |
|---|---|
| artifacts | Directory of Python code, config JSON and readme artifacts for resources |
| api-users.tf.json | The ApiUser resources |
| apps.tf.json | The App resources |
| functions.tf.json | The Function data sources and resources |
| kms-keys.tf.json | The KmsKey resources (except the Tenant default KmsKey) |
| main.tf.json | The terraform block |
| managed-node-types.tf.json | The ManagedNodeType data sources and resources |
| message-types.tf.json | The MessageType data sources and resources |
| nodes.tf.json | The Node data sources and resources |
| provider.tf.json | The provider block |
| tenant-users.tf.json | The TenantUser resources |
| tenant.json | The Tenant resource |
| terraform.tfstate | The current state, imported |
Using the output as-is
You may use the output from echostream-terrafy as-is to manage your Tenant.
Simply make any changes that you wish to it and run terraform plan or terraform apply.
Warning - rerunning
echostream-terrafyafter you have made manual changes will result in those changes being overwritten!
Using the output as a Terraform module
- Copy all of the
.tf.jsonfiles and theartifactsdirectory to another folder. - Remove
provider.tf.json. The provider should be passed in by the module caller. - Add a
variables.tffile and variablize any input (e.g. - configs) that you wish to be modifiable by module users. - Add an
outputs.tffile and output any information that needs to be accessed by module users. - Register the module with a public/private Terraform registry or include it in a
modulesdirectory (either directly or as agitsubmodule) in another Terraform project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file echostream_terrafy-0.0.12.tar.gz.
File metadata
- Download URL: echostream_terrafy-0.0.12.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa630466ee67c7e786e5e425de789a3b235766628cb69804ff0b56e12152d2fc
|
|
| MD5 |
e0ff644658e06142b3bfd0a24572abd1
|
|
| BLAKE2b-256 |
2eddb1b34d73ccb13fd6e0793e8fc1a89a3bf96edad29d8d943691906a12f8c0
|
File details
Details for the file echostream_terrafy-0.0.12-py3-none-any.whl.
File metadata
- Download URL: echostream_terrafy-0.0.12-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2aef0549baf71cfe1f323c7e401d508909f6b4eb3a20026b150ffe40dd5e0e6
|
|
| MD5 |
f63457d5385bbef5f7bc73e213388714
|
|
| BLAKE2b-256 |
30ee55e058b70e095ef87a399cc69ea6ed4659e0929c048cb5fcbad0b2f6e79b
|