Skip to main content
TerraformResource represents a resource in Terraform.

TerraformMetaArguments

All resources support the following meta-arguments:
PropertyTypeDescription
dependsOnITerraformAddressable[]Explicit dependencies.
countnumber | TerraformCountResource count.
providerTerraformProviderSpecific provider instance.
lifecycleTerraformResourceLifecycleLifecycle configuration.
forEachTerraformIteratorIterator for multiple resources.

TerraformResourceLifecycle

PropertyTypeDescription
createBeforeDestroybooleanCreate new resource before destroying old one.
preventDestroybooleanPrevent accidental destruction.
ignoreChangesstring[]List of attributes to ignore changes for.
replaceTriggeredByany[]Replace resource when these change.

Methods

importFrom()

importFrom(id: string): void
Configures the resource to be imported from an existing ID.

moveTo()

moveTo(target: string): void
Moves the resource to a new address in the state.

moveToId()

moveToId(id: string): void
Moves the resource to a specific ID.

moveFromId()

moveFromId(id: string): void
Moves the resource from a specific ID.

interpolationForAttribute()

interpolationForAttribute(attr: string): IResolvable
Returns an interpolation token for a specific attribute.

getStringAttribute()

getStringAttribute(name: string): string
Returns a string attribute value.

getNumberAttribute()

getNumberAttribute(name: string): number
Returns a number attribute value.

getBooleanAttribute()

getBooleanAttribute(name: string): boolean
Returns a boolean attribute value.

getListAttribute()

getListAttribute(name: string): string[]
Returns a list attribute value.

getMapAttribute()

getMapAttribute(name: string): Record<string, any>
Returns a map attribute value.