Skip to main content
The DataResource implements the standard resource lifecycle, but does not directly take any other actions. You can use the DataResource resource without requiring or configuring a provider. The DataResource resource is useful for storing values which need to follow a manage resource lifecycle, and for triggering provisioners when there is no other logical managed resource in which to place them. It requires Terraform 1.4 or later. It is also possible to generate these bindings by adding “terraform.io/builtin/terraform” to the “terraformProviders” key in your cdktf.json file and running “cdktn get”. https://developer.hashicorp.com/terraform/language/resources/terraform-data

Initializers

import "github.com/open-constructs/cdk-terrain-go/cdktn"

cdktn.NewDataResource(scope Construct, id *string, config DataConfig) DataResource
NameTypeDescription
scopegithub.com/aws/constructs-go/constructs/v10.ConstructThe scope in which to define this construct.
id*stringThe scoped construct ID.
configDataConfigNo description.

scopeRequired

  • Type: github.com/aws/constructs-go/constructs/v10.Construct
The scope in which to define this construct.

idRequired

  • Type: *string
The scoped construct ID. Must be unique amongst siblings in the same scope

configOptional


Methods

NameDescription
ToStringReturns a string representation of this construct.
AddOverrideNo description.
OverrideLogicalIdOverrides the auto-generated logical ID with a specific ID.
ResetOverrideLogicalIdResets a previously passed logical Id to use the auto-generated logical id again.
ToHclTerraformNo description.
ToMetadataNo description.
ToTerraformAdds this resource to the terraform JSON output.
AddMoveTargetAdds a user defined moveTarget string to this resource to be later used in .moveTo(moveTarget) to resolve the location of the move.
GetAnyMapAttributeNo description.
GetBooleanAttributeNo description.
GetBooleanMapAttributeNo description.
GetListAttributeNo description.
GetNumberAttributeNo description.
GetNumberListAttributeNo description.
GetNumberMapAttributeNo description.
GetStringAttributeNo description.
GetStringMapAttributeNo description.
HasResourceMoveNo description.
ImportFromNo description.
InterpolationForAttributeNo description.
MoveFromIdMove the resource corresponding to “id” to this resource.
MoveToMoves this resource to the target resource given by moveTarget.
MoveToIdMoves this resource to the resource corresponding to “id”.
ResetInputNo description.
ResetTriggersReplaceNo description.

ToString

func ToString() *string
Returns a string representation of this construct.

AddOverride

func AddOverride(path *string, value interface{})

pathRequired

  • Type: *string

valueRequired

  • Type: interface{}

OverrideLogicalId

func OverrideLogicalId(newLogicalId *string)
Overrides the auto-generated logical ID with a specific ID.

newLogicalIdRequired

  • Type: *string
The new logical ID to use for this stack element.

ResetOverrideLogicalId

func ResetOverrideLogicalId()
Resets a previously passed logical Id to use the auto-generated logical id again.

ToHclTerraform

func ToHclTerraform() interface{}

ToMetadata

func ToMetadata() interface{}

ToTerraform

func ToTerraform() interface{}
Adds this resource to the terraform JSON output.

AddMoveTarget

func AddMoveTarget(moveTarget *string)
Adds a user defined moveTarget string to this resource to be later used in .moveTo(moveTarget) to resolve the location of the move.

moveTargetRequired

  • Type: *string
The string move target that will correspond to this resource.

GetAnyMapAttribute

func GetAnyMapAttribute(terraformAttribute *string) *map[string]interface{}

terraformAttributeRequired

  • Type: *string

GetBooleanAttribute

func GetBooleanAttribute(terraformAttribute *string) IResolvable

terraformAttributeRequired

  • Type: *string

GetBooleanMapAttribute

func GetBooleanMapAttribute(terraformAttribute *string) *map[string]*bool

terraformAttributeRequired

  • Type: *string

GetListAttribute

func GetListAttribute(terraformAttribute *string) *[]*string

terraformAttributeRequired

  • Type: *string

GetNumberAttribute

func GetNumberAttribute(terraformAttribute *string) *f64

terraformAttributeRequired

  • Type: *string

GetNumberListAttribute

func GetNumberListAttribute(terraformAttribute *string) *[]*f64

terraformAttributeRequired

  • Type: *string

GetNumberMapAttribute

func GetNumberMapAttribute(terraformAttribute *string) *map[string]*f64

terraformAttributeRequired

  • Type: *string

GetStringAttribute

func GetStringAttribute(terraformAttribute *string) *string

terraformAttributeRequired

  • Type: *string

GetStringMapAttribute

func GetStringMapAttribute(terraformAttribute *string) *map[string]*string

terraformAttributeRequired

  • Type: *string

HasResourceMove

func HasResourceMove() interface{}

ImportFrom

func ImportFrom(id *string, provider TerraformProvider)

idRequired

  • Type: *string

providerOptional


InterpolationForAttribute

func InterpolationForAttribute(terraformAttribute *string) IResolvable

terraformAttributeRequired

  • Type: *string

MoveFromId

func MoveFromId(id *string)
Move the resource corresponding to “id” to this resource. Note that the resource being moved from must be marked as moved using it’s instance function.

idRequired

  • Type: *string
Full id of resource being moved from, e.g. “aws_s3_bucket.example”.

MoveTo

func MoveTo(moveTarget *string, index interface{})
Moves this resource to the target resource given by moveTarget.

moveTargetRequired

  • Type: *string
The previously set user defined string set by .addMoveTarget() corresponding to the resource to move to.

indexOptional

  • Type: interface{}
Optional The index corresponding to the key the resource is to appear in the foreach of a resource to move to.

MoveToId

func MoveToId(id *string)
Moves this resource to the resource corresponding to “id”.

idRequired

  • Type: *string
Full id of resource to move to, e.g. “aws_s3_bucket.example”.

ResetInput

func ResetInput()

ResetTriggersReplace

func ResetTriggersReplace()

Static Functions

NameDescription
IsConstructChecks if x is a construct.
IsTerraformElementNo description.
IsTerraformResourceNo description.
GenerateConfigForImportGenerates CDKTN code for importing a Data resource upon running “cdktn plan < stack-name >”.

IsConstruct

import "github.com/open-constructs/cdk-terrain-go/cdktn"

cdktn.DataResource_IsConstruct(x interface{}) *bool
Checks if x is a construct. Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked. Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired

  • Type: interface{}
Any object.

IsTerraformElement

import "github.com/open-constructs/cdk-terrain-go/cdktn"

cdktn.DataResource_IsTerraformElement(x interface{}) *bool

xRequired

  • Type: interface{}

IsTerraformResource

import "github.com/open-constructs/cdk-terrain-go/cdktn"

cdktn.DataResource_IsTerraformResource(x interface{}) *bool

xRequired

  • Type: interface{}

GenerateConfigForImport

import "github.com/open-constructs/cdk-terrain-go/cdktn"

cdktn.DataResource_GenerateConfigForImport(scope Construct, importToId *string, importFromId *string, provider TerraformProvider) ImportableResource
Generates CDKTN code for importing a Data resource upon running “cdktn plan < stack-name >”.

scopeRequired

  • Type: github.com/aws/constructs-go/constructs/v10.Construct
The scope in which to define this construct.

importToIdRequired

  • Type: *string
The construct id used in the generated config for the Data to import.

importFromIdRequired

  • Type: *string
The id of the existing Data that should be imported. Refer to the import section in the documentation of this resource for the id to use

providerOptional

? Optional instance of the provider where the Data to import is found.

Properties

NameTypeDescription
Nodegithub.com/aws/constructs-go/constructs/v10.NodeThe tree node.
CdktfStackTerraformStackNo description.
Fqn*stringNo description.
FriendlyUniqueId*stringNo description.
TerraformMetaArguments*map[string]interface{}No description.
TerraformResourceType*stringNo description.
TerraformGeneratorMetadataTerraformProviderGeneratorMetadataNo description.
Connectioninterface{}No description.
Countinterface{}No description.
DependsOn*[]*stringNo description.
ForEachITerraformIteratorNo description.
LifecycleTerraformResourceLifecycleNo description.
ProviderTerraformProviderNo description.
Provisioners*[]interface{}No description.
Id*stringNo description.
OutputAnyMapNo description.
InputInput*map[string]interface{}No description.
TriggersReplaceInput*map[string]interface{}No description.
Input*map[string]interface{}(Optional) A value which will be stored in the instance state, and reflected in the output attribute after apply.
TriggersReplace*map[string]interface{}(Optional) A value which is stored in the instance state, and will force replacement when the value changes.

NodeRequired

func Node() Node
  • Type: github.com/aws/constructs-go/constructs/v10.Node
The tree node.

CdktfStackRequired

func CdktfStack() TerraformStack

FqnRequired

func Fqn() *string
  • Type: *string

FriendlyUniqueIdRequired

func FriendlyUniqueId() *string
  • Type: *string

TerraformMetaArgumentsRequired

func TerraformMetaArguments() *map[string]interface{}
  • Type: *map[string]interface{}

TerraformResourceTypeRequired

func TerraformResourceType() *string
  • Type: *string

TerraformGeneratorMetadataOptional

func TerraformGeneratorMetadata() TerraformProviderGeneratorMetadata

ConnectionOptional

func Connection() interface{}
  • Type: interface{}

CountOptional

func Count() interface{}
  • Type: interface{}

DependsOnOptional

func DependsOn() *[]*string
  • Type: *[]*string

ForEachOptional

func ForEach() ITerraformIterator

LifecycleOptional

func Lifecycle() TerraformResourceLifecycle

ProviderOptional

func Provider() TerraformProvider

ProvisionersOptional

func Provisioners() *[]interface{}
  • Type: *[]interface{}

IdRequired

func Id() *string
  • Type: *string

OutputRequired

func Output() AnyMap

InputInputOptional

func InputInput() *map[string]interface{}
  • Type: *map[string]interface{}

TriggersReplaceInputOptional

func TriggersReplaceInput() *map[string]interface{}
  • Type: *map[string]interface{}

InputRequired

func Input() *map[string]interface{}
  • Type: *map[string]interface{}
(Optional) A value which will be stored in the instance state, and reflected in the output attribute after apply. https://developer.hashicorp.com/terraform/language/resources/terraform-data#input

TriggersReplaceRequired

func TriggersReplace() *map[string]interface{}
  • Type: *map[string]interface{}
(Optional) A value which is stored in the instance state, and will force replacement when the value changes. https://developer.hashicorp.com/terraform/language/resources/terraform-data#triggers\_replace

Constants

NameTypeDescription
TfResourceType*stringNo description.

TfResourceTypeRequired

func TfResourceType() *string
  • Type: *string