tfmodulestack

package module
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

cdktf-tf-module-stack

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct.

Available Packages

NPM

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

npm install @cdktf/tf-module-stack

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";

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.

Documentation

Overview

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

A drop-in replacement for cdktf.TerraformStack that let's you define Terraform modules as construct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProviderRequirement_Override

func NewProviderRequirement_Override(p ProviderRequirement, scope constructs.Construct, providerName *string, providerVersionConstraint *string, terraformProviderSource *string)

func NewTFModuleApp_Override

func NewTFModuleApp_Override(t TFModuleApp, options *cdktf.AppConfig)

func NewTFModuleOutput_Override

func NewTFModuleOutput_Override(t TFModuleOutput, scope constructs.Construct, name *string, config *cdktf.TerraformOutputConfig)

func NewTFModuleStack_Override

func NewTFModuleStack_Override(t TFModuleStack, scope constructs.Construct, id *string)

Experimental.

func NewTFModuleVariable_Override

func NewTFModuleVariable_Override(t TFModuleVariable, scope constructs.Construct, name *string, config *cdktf.TerraformVariableConfig)

func ProviderRequirement_IsConstruct

func ProviderRequirement_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func ProviderRequirement_IsTerraformElement

func ProviderRequirement_IsTerraformElement(x interface{}) *bool

Experimental.

func ProviderRequirement_IsTerraformProvider

func ProviderRequirement_IsTerraformProvider(x interface{}) *bool

Experimental.

func TFModuleApp_IsApp

func TFModuleApp_IsApp(x interface{}) *bool

Experimental.

func TFModuleApp_IsConstruct

func TFModuleApp_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func TFModuleApp_Of

func TFModuleApp_Of(construct constructs.IConstruct) cdktf.App

Experimental.

func TFModuleOutput_IsConstruct

func TFModuleOutput_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func TFModuleOutput_IsTerraformElement

func TFModuleOutput_IsTerraformElement(x interface{}) *bool

Experimental.

func TFModuleOutput_IsTerraformOutput

func TFModuleOutput_IsTerraformOutput(x interface{}) *bool

Experimental.

func TFModuleStack_IsConstruct

func TFModuleStack_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func TFModuleStack_IsStack

func TFModuleStack_IsStack(x interface{}) *bool

Experimental.

func TFModuleStack_Of

func TFModuleStack_Of(construct constructs.IConstruct) cdktf.TerraformStack

Experimental.

func TFModuleVariable_IsConstruct

func TFModuleVariable_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func TFModuleVariable_IsTerraformElement

func TFModuleVariable_IsTerraformElement(x interface{}) *bool

Experimental.

Types

type ProviderRequirement

type ProviderRequirement interface {
	cdktf.TerraformProvider
	// Experimental.
	Alias() *string
	// Experimental.
	SetAlias(val *string)
	// Experimental.
	CdktfStack() cdktf.TerraformStack
	// Experimental.
	ConstructNodeMetadata() *map[string]interface{}
	// Experimental.
	Fqn() *string
	// Experimental.
	FriendlyUniqueId() *string
	// Experimental.
	MetaAttributes() *map[string]interface{}
	// The tree node.
	Node() constructs.Node
	// Experimental.
	RawOverrides() interface{}
	// Experimental.
	TerraformGeneratorMetadata() *cdktf.TerraformProviderGeneratorMetadata
	// Experimental.
	TerraformProviderSource() *string
	// Experimental.
	TerraformResourceType() *string
	// Experimental.
	AddOverride(path *string, value interface{})
	// Overrides the auto-generated logical ID with a specific ID.
	// Experimental.
	OverrideLogicalId(newLogicalId *string)
	// Resets a previously passed logical Id to use the auto-generated logical id again.
	// Experimental.
	ResetOverrideLogicalId()
	// Experimental.
	SynthesizeAttributes() *map[string]interface{}
	// Experimental.
	ToMetadata() interface{}
	// Returns a string representation of this construct.
	ToString() *string
	// Adds this resource to the terraform JSON output.
	// Experimental.
	ToTerraform() interface{}
}

func NewProviderRequirement

func NewProviderRequirement(scope constructs.Construct, providerName *string, providerVersionConstraint *string, terraformProviderSource *string) ProviderRequirement

type TFModuleApp

type TFModuleApp interface {
	cdktf.App
	// Experimental.
	Manifest() cdktf.Manifest
	// The tree node.
	Node() constructs.Node
	// The output directory into which resources will be synthesized.
	// Experimental.
	Outdir() *string
	// Whether to skip the validation during synthesis of the app.
	// Experimental.
	SkipValidation() *bool
	// The stack which will be synthesized.
	//
	// If not set, all stacks will be synthesized.
	// Experimental.
	TargetStackId() *string
	// Creates a reference from one stack to another, invoked on prepareStack since it creates extra resources.
	// Experimental.
	CrossStackReference(fromStack cdktf.TerraformStack, toStack cdktf.TerraformStack, identifier *string) *string
	// Synthesizes all resources to the output directory.
	// Experimental.
	Synth()
	// Returns a string representation of this construct.
	ToString() *string
}

func NewTFModuleApp

func NewTFModuleApp(options *cdktf.AppConfig) TFModuleApp

type TFModuleOutput

type TFModuleOutput interface {
	cdktf.TerraformOutput
	// Experimental.
	CdktfStack() cdktf.TerraformStack
	// Experimental.
	ConstructNodeMetadata() *map[string]interface{}
	// Experimental.
	DependsOn() *[]cdktf.ITerraformDependable
	// Experimental.
	SetDependsOn(val *[]cdktf.ITerraformDependable)
	// Experimental.
	Description() *string
	// Experimental.
	SetDescription(val *string)
	// Experimental.
	Fqn() *string
	// Experimental.
	FriendlyUniqueId() *string
	// The tree node.
	Node() constructs.Node
	// Experimental.
	RawOverrides() interface{}
	// Experimental.
	Sensitive() *bool
	// Experimental.
	SetSensitive(val *bool)
	// Experimental.
	StaticId() *bool
	// Experimental.
	SetStaticId(val *bool)
	// Experimental.
	Value() interface{}
	// Experimental.
	SetValue(val interface{})
	// Experimental.
	AddOverride(path *string, value interface{})
	// Overrides the auto-generated logical ID with a specific ID.
	// Experimental.
	OverrideLogicalId(newLogicalId *string)
	// Resets a previously passed logical Id to use the auto-generated logical id again.
	// Experimental.
	ResetOverrideLogicalId()
	// Experimental.
	SynthesizeAttributes() *map[string]interface{}
	// Experimental.
	ToMetadata() interface{}
	// Returns a string representation of this construct.
	ToString() *string
	ToTerraform() interface{}
}

func NewTFModuleOutput

func NewTFModuleOutput(scope constructs.Construct, name *string, config *cdktf.TerraformOutputConfig) TFModuleOutput

type TFModuleStack

type TFModuleStack interface {
	cdktf.TerraformStack
	// Experimental.
	Dependencies() *[]cdktf.TerraformStack
	// Experimental.
	SetDependencies(val *[]cdktf.TerraformStack)
	// The tree node.
	Node() constructs.Node
	// Experimental.
	Synthesizer() cdktf.IStackSynthesizer
	// Experimental.
	SetSynthesizer(val cdktf.IStackSynthesizer)
	// Experimental.
	AddDependency(dependency cdktf.TerraformStack)
	// Experimental.
	AddOverride(path *string, value interface{})
	// Returns the naming scheme used to allocate logical IDs.
	//
	// By default, uses
	// the `HashedAddressingScheme` but this method can be overridden to customize
	// this behavior.
	// Experimental.
	AllocateLogicalId(tfElement interface{}) *string
	// Experimental.
	AllProviders() *[]cdktf.TerraformProvider
	// Experimental.
	DependsOn(stack cdktf.TerraformStack) *bool
	// Experimental.
	EnsureBackendExists() cdktf.TerraformBackend
	// Experimental.
	GetLogicalId(tfElement interface{}) *string
	// Experimental.
	PrepareStack()
	// Experimental.
	RegisterIncomingCrossStackReference(fromStack cdktf.TerraformStack) cdktf.TerraformRemoteState
	// Experimental.
	RegisterOutgoingCrossStackReference(identifier *string) cdktf.TerraformOutput
	// Run all validations on the stack.
	// Experimental.
	RunAllValidations()
	// Returns a string representation of this construct.
	ToString() *string
	ToTerraform() interface{}
}

func NewTFModuleStack

func NewTFModuleStack(scope constructs.Construct, id *string) TFModuleStack

Experimental.

type TFModuleVariable

type TFModuleVariable interface {
	cdktf.TerraformVariable
	// Experimental.
	BooleanValue() cdktf.IResolvable
	// Experimental.
	CdktfStack() cdktf.TerraformStack
	// Experimental.
	ConstructNodeMetadata() *map[string]interface{}
	// Experimental.
	Default() interface{}
	// Experimental.
	Description() *string
	// Experimental.
	Fqn() *string
	// Experimental.
	FriendlyUniqueId() *string
	// Experimental.
	ListValue() *[]*string
	// The tree node.
	Node() constructs.Node
	// Experimental.
	Nullable() *bool
	// Experimental.
	NumberValue() *float64
	// Experimental.
	RawOverrides() interface{}
	// Experimental.
	Sensitive() *bool
	// Experimental.
	StringValue() *string
	// Experimental.
	Type() *string
	// Experimental.
	Validation() *[]*cdktf.TerraformVariableValidationConfig
	// Experimental.
	Value() interface{}
	// Experimental.
	AddOverride(path *string, value interface{})
	// Experimental.
	AddValidation(validation *cdktf.TerraformVariableValidationConfig)
	// Overrides the auto-generated logical ID with a specific ID.
	// Experimental.
	OverrideLogicalId(newLogicalId *string)
	// Resets a previously passed logical Id to use the auto-generated logical id again.
	// Experimental.
	ResetOverrideLogicalId()
	// Experimental.
	SynthesizeAttributes() *map[string]interface{}
	// Experimental.
	ToMetadata() interface{}
	// Returns a string representation of this construct.
	ToString() *string
	ToTerraform() interface{}
}

func NewTFModuleVariable

func NewTFModuleVariable(scope constructs.Construct, name *string, config *cdktf.TerraformVariableConfig) TFModuleVariable

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL