npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

commercetools-terraform-generator

v2.1.2

Published

A CLI tool to generate Terraform Configuration files from existing Commercetools projects.

Readme

Commercetools Terraform Generator

A CLI tool to generate Terraform Configuration files from existing Commercetools projects.

Usage

  1. npm i commercetools-terraform-generator
  2. Use the different env values to configure the generator (see Configuration). If a .env is provided at the root of your project it will be used.
  3. Run npx commercetools-terraform-generator.
  4. You can now use the generated .tf files from the output directory in your IaC setup using the labd commercetools terraform provider.

Configuration

IMPORT_RESOURCE - required

The resources to import from the commercetools project and transform into terraform files, separated by commas. Values should correspond to at least one of the resources of labd commercetools terraform provider.

Supported values:

Example:

  • "types,tax_category""
  • "types"
  • "all"

OUTPUT_DIR - required

The directory to generate the Terraform .tf files.

Examples:

  • "output"
  • "/home/user/terraform_files/"

CTP_AUTH_URL - required

Specifies the Commercetools auth url to use.

Example: "https://auth.europe-west1.gcp.commercetools.com/"

CTP_API_URL - required

Specifies the Commercetools api url to use.

Example: "https://api.europe-west1.gcp.commercetools.com/"

CTP_CLIENT_ID - required

Specifies the Commercetools API Client id to use, more info in the HTTP API autorization Commercetools documentation.

CTP_CLIENT_SECRET - required

Specifies the Commercetools API Client secret to use, more info in the HTTP API autorization Commercetools documentation.

CTP_PROJECT_KEY - required

Specifies the Commercetools project you want to import the resources from.

CTP_SCOPES - optional

Specifies the scopes you want to use, separated by spaces. If not specified all scopes defined for the API Client will be used.

Examples:

  • "manage_types:myproject"
  • "manage_types:myproject manage_tax_categories:myproject"

ENABLE_CTP_LOGS - optional

Specifies the Commercetools logger should be used.

Supported values: "true" or "false". "false" if not specified.

SEPERATE_RESOURCES - optional

Specifies if the generated terraform configuration files should be grouped in resource type folder.

Supported values: "true" or "false". "false" if not specified, meaning all files will be generated in the directory specified by OUTPUT_DIR.

"All included" docker folder

The docker folder in this package's github repository contains the docker compose file and the provider.tf to run both this npm package and the labd commercetools terraform provider with terraform in a docker image.

  1. Add your .env file in the folder.
  2. Install the npm package and init terraform: docker compose up
  3. Generate the terraform configuration files: sudo docker compose run --rm generator npx commercetools-terraform-generator
  4. Plan terraform changes: docker compose run --rm terraform plan
  5. Apply the changes: docker compose run --rm terraform apply

Todolist