# cdktf-tf-module-stack
![Status: Tech Preview](https://img.shields.io/badge/status-experimental-EAAA32) [![Releases](https://img.shields.io/github/release/cdktf/cdktf-tf-module-stack.svg)](https://github.com/cdktf/cdktf-tf-module-stack/releases)
[![LICENSE](https://img.shields.io/github/license/cdktf/cdktf-tf-module-stack.svg)](https://github.com/cdktf/cdktf-tf-module-stack/blob/main/LICENSE)
[![build](https://github.com/cdktf/cdktf-tf-module-stack/actions/workflows/build.yml/badge.svg)](https://github.com/cdktf/cdktf-tf-module-stack/actions/workflows/build.yml)
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](https://github.com/cdktf/cdktf-tf-module-stack/issues/new/choose) 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](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](https://www.npmjs.com/package/cdktf-tf-module-stack).
### PyPI
The PyPI package is available at [https://pypi.org/project/cdktf-tf-module-stack](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](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](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`](https://github.com/cdktf/cdktf-tf-module-stack-go) package.
`go get github.com/cdktf/cdktf-tf-module-stack-go/tfmodulestack`
## Usage
### Typescript
```python
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
```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:
```json
{
"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.
Raw data
{
"_id": null,
"home_page": "https://github.com/cdktf/cdktf-tf-module-stack.git",
"name": "cdktf-tf-module-stack",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "HashiCorp",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/55/54/0cebd7e0c76e8c393442657382cc39602cc6cfddcae96edbbc365904349a/cdktf_tf_module_stack-5.0.45.tar.gz",
"platform": null,
"description": "# cdktf-tf-module-stack\n\n![Status: Tech Preview](https://img.shields.io/badge/status-experimental-EAAA32) [![Releases](https://img.shields.io/github/release/cdktf/cdktf-tf-module-stack.svg)](https://github.com/cdktf/cdktf-tf-module-stack/releases)\n[![LICENSE](https://img.shields.io/github/license/cdktf/cdktf-tf-module-stack.svg)](https://github.com/cdktf/cdktf-tf-module-stack/blob/main/LICENSE)\n[![build](https://github.com/cdktf/cdktf-tf-module-stack/actions/workflows/build.yml/badge.svg)](https://github.com/cdktf/cdktf-tf-module-stack/actions/workflows/build.yml)\n\nA drop-in replacement for cdktf.TerraformStack that lets you define Terraform modules as constructs.\n\n*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](https://github.com/cdktf/cdktf-tf-module-stack/issues/new/choose) generously and detail your experience while using the library. We welcome your feedback.\n\nBy using the software in this repository, you acknowledge that:\n\n* *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.\n* *cdktf-tf-module-stack* is provided on an \"as-is\" basis, and may include bugs, errors, or other issues.\n* *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*.\n* 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.\n\n## Compatibility\n\n* `cdktf` >= 0.20.0\n* `constructs` >= 10.0.25\n\n## Available Packages\n\n### NPM\n\nThe npm package is available at [https://www.npmjs.com/package/@cdktf/tf-module-stack](https://www.npmjs.com/package/@cdktf/tf-module-stack).\n\n`npm install @cdktf/tf-module-stack`\n\nNOTE: Originally, this package was named `cdktf-tf-module-stack`, and the legacy versions (<= 0.2.0) can be found on npm [here](https://www.npmjs.com/package/cdktf-tf-module-stack).\n\n### PyPI\n\nThe PyPI package is available at [https://pypi.org/project/cdktf-tf-module-stack](https://pypi.org/project/cdktf-tf-module-stack).\n\n`pipenv install cdktf-tf-module-stack`\n\n### Nuget\n\nThe Nuget package is available at [https://www.nuget.org/packages/HashiCorp.Cdktf.TfModuleStack](https://www.nuget.org/packages/HashiCorp.Cdktf.TfModuleStack).\n\n`dotnet add package HashiCorp.Cdktf.TfModuleStack`\n\n### Maven\n\nThe Maven package is available at [https://mvnrepository.com/artifact/com.hashicorp/cdktf-tf-module-stack](https://mvnrepository.com/artifact/com.hashicorp/cdktf-tf-module-stack).\n\n```\n<dependency>\n <groupId>com.hashicorp</groupId>\n <artifactId>cdktf-tf-module-stack</artifactId>\n <version>[REPLACE WITH DESIRED VERSION]</version>\n</dependency>\n```\n\n### Go\n\nThe go package is generated into the [`github.com/cdktf/cdktf-tf-module-stack-go`](https://github.com/cdktf/cdktf-tf-module-stack-go) package.\n\n`go get github.com/cdktf/cdktf-tf-module-stack-go/tfmodulestack`\n\n## Usage\n\n### Typescript\n\n```python\nimport { App } from \"cdktf\";\nimport {\n TFModuleStack,\n TFModuleVariable,\n TFModuleOutput,\n ProviderRequirement,\n} from \"@cdktf/tf-module-stack\";\nimport { Resource } from '@cdktf/provider-null/lib/resource';\n\nclass MyAwesomeModule extends TFModuleStack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n new ProviderRequirement(this, \"null\", \"~> 2.0\");\n const resource = new Resource(this, \"resource\");\n\n new TFModuleVariable(this, \"my_var\", {\n type: \"string\",\n description: \"A variable\",\n default: \"default\",\n });\n\n new TFModuleOutput(this, \"my_output\", {\n value: resource.id,\n });\n }\n}\n\nconst app = new App();\nnew MyAwesomeModule(app, \"my-awesome-module\");\napp.synth();\n```\n\n### Python\n\n```python\nfrom constructs import Construct\nfrom cdktf import App, TerraformStack\nfrom imports.null.resource import Resource\nfrom cdktf_tf_module_stack import TFModuleStack, TFModuleVariable, TFModuleOutput, ProviderRequirement\n\n\nclass MyAwesomeModule(TFModuleStack):\n def __init__(self, scope: Construct, ns: str):\n super().__init__(scope, ns)\n\n ProviderRequirement(self, \"null\", provider_version_constraint=\"~> 2.0\")\n\n TFModuleVariable(self, \"my_var\", type=\"string\", description=\"A variable\", default=\"default\")\n\n resource = Resource(self, \"resource\")\n\n TFModuleOutput(self, \"my_output\", value=resource.id)\n\n\napp = App()\nMyAwesomeModule(app, \"my-awesome-module\")\napp.synth()\n```\n\nThis will synthesize a Terraform JSON file that looks like this:\n\n```json\n{\n \"output\": {\n \"my_output\": [\n {\n \"value\": \"${null_resource.resource.id}\"\n }\n ]\n },\n \"resource\": {\n \"null_resource\": {\n \"resource\": {}\n }\n },\n \"terraform\": {\n \"required_providers\": {\n \"null\": {\n \"source\": \"null\",\n \"version\": \"~> 2.0\"\n }\n },\n \"variable\": {\n \"my_var\": {\n \"default\": \"default\",\n \"description\": \"A variable\",\n \"type\": \"string\"\n }\n }\n }\n}\n```\n\nPlease 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.\n",
"bugtrack_url": null,
"license": "MPL-2.0",
"summary": "A drop-in replacement for cdktf.TerraformStack that lets you define Terraform modules as constructs",
"version": "5.0.45",
"project_urls": {
"Homepage": "https://github.com/cdktf/cdktf-tf-module-stack.git",
"Source": "https://github.com/cdktf/cdktf-tf-module-stack.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8f0e4ddbbdcc972685d202a309cec85f5ef25efc5de9a16c895e46a58e76bc8a",
"md5": "34fb08dea98dc2612c2f627797233ec2",
"sha256": "e839a7f6f7dfca5acb87e0ce8cea2b49c24cd0d4fe2c091cb9addf4e741875ea"
},
"downloads": -1,
"filename": "cdktf_tf_module_stack-5.0.45-py3-none-any.whl",
"has_sig": false,
"md5_digest": "34fb08dea98dc2612c2f627797233ec2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 53817,
"upload_time": "2024-12-23T00:16:24",
"upload_time_iso_8601": "2024-12-23T00:16:24.050494Z",
"url": "https://files.pythonhosted.org/packages/8f/0e/4ddbbdcc972685d202a309cec85f5ef25efc5de9a16c895e46a58e76bc8a/cdktf_tf_module_stack-5.0.45-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "55540cebd7e0c76e8c393442657382cc39602cc6cfddcae96edbbc365904349a",
"md5": "417a9005eb16ad5f43d88a3138a6f590",
"sha256": "9da5ae53a5d51a2f1b9ed99ef9f428114e9de3c809666d3c3747a5b70525a7a9"
},
"downloads": -1,
"filename": "cdktf_tf_module_stack-5.0.45.tar.gz",
"has_sig": false,
"md5_digest": "417a9005eb16ad5f43d88a3138a6f590",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 55563,
"upload_time": "2024-12-23T00:16:26",
"upload_time_iso_8601": "2024-12-23T00:16:26.933471Z",
"url": "https://files.pythonhosted.org/packages/55/54/0cebd7e0c76e8c393442657382cc39602cc6cfddcae96edbbc365904349a/cdktf_tf_module_stack-5.0.45.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-23 00:16:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cdktf",
"github_project": "cdktf-tf-module-stack",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cdktf-tf-module-stack"
}