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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cdktf/tf-module-stack

v5.0.14

Published

A drop-in replacement for cdktf.TerraformStack that lets you define Terraform modules as constructs

Downloads

3,338

Readme

cdktf-tf-module-stack

Status: Tech Preview Releases LICENSE build

A drop-in replacement for cdktf.TerraformStack that lets you define Terraform modules as constructs.

cdktf-tf-module-stack is in technical preview, which means it's a community supported project. It still requires extensive testing and polishing to mature into a HashiCorp officially supported project. Please file issues generously and detail your experience while using the library. We welcome your feedback.

By using the software in this repository, you acknowledge that:

  • cdktf-tf-module-stack is still in development, may change, and has not been released as a commercial product by HashiCorp and is not currently supported in any way by HashiCorp.
  • cdktf-tf-module-stack is provided on an "as-is" basis, and may include bugs, errors, or other issues.
  • cdktf-tf-module-stack is NOT INTENDED FOR PRODUCTION USE, use of the Software may result in unexpected results, loss of data, or other unexpected results, and HashiCorp disclaims any and all liability resulting from use of cdktf-tf-module-stack.
  • HashiCorp reserves all rights to make all decisions about the features, functionality and commercial release (or non-release) of cdktf-tf-module-stack, at any time and without any obligation or liability whatsoever.

Compatibility

  • cdktf >= 0.20.0
  • constructs >= 10.0.25

Available Packages

NPM

The npm package is available at https://www.npmjs.com/package/@cdktf/tf-module-stack.

npm install @cdktf/tf-module-stack

NOTE: Originally, this package was named cdktf-tf-module-stack, and the legacy versions (<= 0.2.0) can be found on npm here.

PyPI

The PyPI package is available at https://pypi.org/project/cdktf-tf-module-stack.

pipenv install cdktf-tf-module-stack

Nuget

The Nuget package is available at https://www.nuget.org/packages/HashiCorp.Cdktf.TfModuleStack.

dotnet add package HashiCorp.Cdktf.TfModuleStack

Maven

The Maven package is available at https://mvnrepository.com/artifact/com.hashicorp/cdktf-tf-module-stack.

<dependency>
    <groupId>com.hashicorp</groupId>
    <artifactId>cdktf-tf-module-stack</artifactId>
    <version>[REPLACE WITH DESIRED VERSION]</version>
</dependency>

Go

The go package is generated into the github.com/cdktf/cdktf-tf-module-stack-go package.

go get github.com/cdktf/cdktf-tf-module-stack-go/tfmodulestack

Usage

Typescript

import { App } from "cdktf";
import {
  TFModuleStack,
  TFModuleVariable,
  TFModuleOutput,
  ProviderRequirement,
} from "@cdktf/tf-module-stack";
import { Resource } from '@cdktf/provider-null/lib/resource';

class MyAwesomeModule extends TFModuleStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new ProviderRequirement(this, "null", "~> 2.0");
    const resource = new Resource(this, "resource");

    new TFModuleVariable(this, "my_var", {
      type: "string",
      description: "A variable",
      default: "default",
    });

    new TFModuleOutput(this, "my_output", {
      value: resource.id,
    });
  }
}

const app = new App();
new MyAwesomeModule(app, "my-awesome-module");
app.synth();

Python

from constructs import Construct
from cdktf import App, TerraformStack
from imports.null.resource import Resource
from cdktf_tf_module_stack import TFModuleStack, TFModuleVariable, TFModuleOutput, ProviderRequirement


class MyAwesomeModule(TFModuleStack):
    def __init__(self, scope: Construct, ns: str):
        super().__init__(scope, ns)

        ProviderRequirement(self, "null", provider_version_constraint="~> 2.0")

        TFModuleVariable(self, "my_var", type="string", description="A variable", default="default")

        resource = Resource(self, "resource")

        TFModuleOutput(self, "my_output", value=resource.id)


app = App()
MyAwesomeModule(app, "my-awesome-module")
app.synth()

This will synthesize a Terraform JSON file that looks like this:

{
  "output": {
    "my_output": [
      {
        "value": "${null_resource.resource.id}"
      }
    ]
  },
  "resource": {
    "null_resource": {
      "resource": {}
    }
  },
  "terraform": {
    "required_providers": {
      "null": {
        "source": "null",
        "version": "~> 2.0"
      }
    },
    "variable": {
      "my_var": {
        "default": "default",
        "description": "A variable",
        "type": "string"
      }
    }
  }
}

Please note that the provider section is missing, so that the Terraform Workspace using the generated module can be used with any provider matching the version.