Skip to main content

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.tfstate file 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:

  1. Install Python >= 3.9 for your device.
  2. Install your preferred HCL client.
    1. Install Terraform >= 1.3.5 for your device.

      Warning - if you do not install Terraform to a location in your PATH, make note of the installation location!

      -OR-

    2. 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!

  3. Install echostream-terrafy.
    1. Using pipx - RECOMMENDED
      pipx install echostream-terrafy
      
    2. Using pip
      1. Create a Python virtual environment for the echostream-terrafy installation.
        python -m venv echostream-terrafy
        
      2. Activate the virtual environment and install echostream-terrafy into it.
        source echostream-terrafy/bin/activate
        pip install echostream-terrafy
        

        Note - to deactivate the virtual environment, simply type deactivate at the command prompt.

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-terrafy and execute it within that directory.

Warning - if you did not install terraform into your PATH, you must let echostream-terrafy know where to find it. This may be accomplished by specifying the --terraform command-line parameter with the full path to the terraform executable.

Warning - while the EchoStream Terraform Provider will run in a non-POSIX environment (e.g. - Windows), echostream-terrafy will NOT generate correct paths in a non-POSIX environment. Path construction is OS dependent. Because of this, echostream-terrafy will 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-terrafy after you have made manual changes will result in those changes being overwritten!

Using the output as a Terraform module

  1. Copy all of the .tf.json files and the artifacts directory to another folder.
  2. Remove provider.tf.json. The provider should be passed in by the module caller.
  3. Add a variables.tf file and variablize any input (e.g. - configs) that you wish to be modifiable by module users.
  4. Add an outputs.tf file and output any information that needs to be accessed by module users.
  5. Register the module with a public/private Terraform registry or include it in a modules directory (either directly or as a git submodule) in another Terraform project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echostream_terrafy-0.0.10.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echostream_terrafy-0.0.10-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file echostream_terrafy-0.0.10.tar.gz.

File metadata

  • Download URL: echostream_terrafy-0.0.10.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for echostream_terrafy-0.0.10.tar.gz
Algorithm Hash digest
SHA256 c3e7126595b9c4fcce48af58978b0b6953f82a42ca5e1fff452341a339ce37be
MD5 c8f1cc68d4788ad275878f7d8e827007
BLAKE2b-256 4b7df7cd0ff0e925820f4cccc9a5e8961856d9be76d055525f086f442572b215

See more details on using hashes here.

File details

Details for the file echostream_terrafy-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for echostream_terrafy-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 421d26eeaf9543d811f0e646240ecd98d4831d8b9bea7ada7f74c66e34ca2d9a
MD5 61506cc33a0918703a5e09528d0456d5
BLAKE2b-256 f9736ee81b83418782ff26b08cb6c70b442f4e7163ddc2c085d5f7973c26feaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page