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 🙏

© 2025 – Pkg Stats / Ryan Hefner

terraform-workspace-clone

v2.2.2

Published

Clone existing TF workspace

Readme

NPM package to clone or duplicate extsting terraform workspace

Getting started

terraform-workspace-clone is a command-line module to clone terraform workspace

🏠 Homepage

Install

npm install -g terraform-workspace-clone

Usage

terraform-workspace-clone needs few details before cloning the workspace. Input can be provided using cli prompts or can pass pre-filled json file as command-line argument.

Cli prompts:

Run below command in cli.

terraform-workspace-clone

Can also use tf-ws-clone , It is a shorthand command.

Example:

✔ TF domain name?  https://app.terraform.io   // Terraform domain, can be cloud or enterprise
✔ Source workspace ID? ws-9xZ3c3iabcdefgh     // Workspace id which you need to clone
✔ New workspace name? 00-test-1               // New workspace name
✔ Destination TF organization name?  abc_org  // TF org name in which new workspace will be created.
✔ (Optional) OAuth Token id from destinaton organization? // Required if want to clone VCS config. Refer 2nd screenshot.
✔ User api token  ****************              // User api token. Screenshot 1. For more details go to `API Token` section of https://www.terraform.io/cloud-docs/users-teams-organizations/users.
✔ Do you want to clone with values? no / yes  // Yes, if want to clone variables with values.

NOTE: User should have permission to access source and destination org.

  1. To generate user api token, go to User Settings -> Tokens -> click on "Create an API token" button -> Create API token -> Copy token -> Done. User API token

  2. To fetch VCS OAuth token ID, Select TF destination organization and go to Settings -> Providers -> Copy OAuth client id. Destination organization should be able to access VCS repo configured in source workspace. If VCS provider not configured then click on Settings -> Providers -> Add VCS provider. VCS token ID

Config file:

Input can be passed using pre-filled json file. JSON file should have below info:

{
    "baseUrl": "https://app.terraform.io",
    "sourceWorkspaceId": "ws-9xZ3c3iabcdefgh",
    "newWorkspaceName": "00-test-1",
    "destinationOrgName": "abc_org",
    "destinationOrgVcsOauthTokenId": "",
    "userApiToken": "Zxcvbnm..............sjhsmD",
    "isCloneValue": true or false
}

and then pass this file as a input.

tf-ws-clone --config=<path to json file>/<filename>.json

This template can be generated using cli command. It will create a config template file with all the required keys tf_ws_clone_config.json at same path from where tf-ws-clone command is executed.

tf-ws-clone initconfig

Example:

tf-ws-clone --config=./tf_ws_clone_config.json

Running on-demand using npx:

Using npx you can run the script on-demand:

npx terraform-workspace-clone
npx terraform-workspace-clone --config=./tf_ws_clone_config.json

Run tests

npm run test

New planned features

  • Clone across multiple domains.
  • Allow config file path also for the required details.

Author

👤 Sachin [email protected]

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 Sachin [email protected]. This project is MIT licensed.