Skip to main content

Initializers

import io.cdktn.cdktn.TerraformIterator;

new TerraformIterator();
NameTypeDescription

Methods

NameDescription
dynamicCreates a dynamic expression that can be used to loop over this iterator in a dynamic block.
forExpressionForListCreates a for expression that results in a list.
forExpressionForMapCreates a for expression that results in a map.
getAnyNo description.
getAnyMapNo description.
getBooleanNo description.
getBooleanMapNo description.
getListNo description.
getMapNo description.
getNumberNo description.
getNumberListNo description.
getNumberMapNo description.
getStringNo description.
getStringMapNo description.
keysCreates a for expression that maps the iterators to its keys.
pluckPropertyCreates a for expression that accesses the key on each element of the iterator.
valuesCreates a for expression that maps the iterators to its value in case it is a map.

dynamic

public IResolvable dynamic(java.util.Map<java.lang.String, java.lang.Object> attributes)
Creates a dynamic expression that can be used to loop over this iterator in a dynamic block. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString. See https://developer.hashicorp.com/terraform/cdktf/concepts/iterators#using-iterators-for-list-attributes

attributesRequired

  • Type: java.util.Map< java.lang.String, java.lang.Object >

forExpressionForList

public IResolvable forExpressionForList(java.lang.String|IResolvable expression)
Creates a for expression that results in a list. This method allows you to create every possible for expression, but requires more knowledge about Terraform’s for expression syntax. For the most common use cases you can use keys(), values(), and pluckProperty() instead. You may write any valid Terraform for each expression, e.g. TerraformIterator.fromList(myIteratorSourceVar).forExpressionForList("val.foo if val.bar == true") will result in [ for key, val in var.myIteratorSource: val.foo if val.bar == true ]. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString.

expressionRequired

The expression to use in the for mapping.

forExpressionForMap

public IResolvable forExpressionForMap(java.lang.String|IResolvable keyExpression, java.lang.String|IResolvable valueExpression)
Creates a for expression that results in a map. This method allows you to create every possible for expression, but requires more knowledge about Terraforms for expression syntax. For the most common use cases you can use keys(), values(), and pluckProperty instead. You may write any valid Terraform for each expression, e.g. TerraformIterator.fromMap(myIteratorSourceVar).forExpressionForMap("key", "val.foo if val.bar == true") will result in \{ for key, val in var.myIteratorSource: key => val.foo if val.bar == true }. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString.

keyExpressionRequired

The expression to use as key in the for mapping.

valueExpressionRequired

The expression to use as value in the for mapping.

getAny

public IResolvable getAny(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getAnyMap

public java.util.Map<java.lang.String, java.lang.Object> getAnyMap(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getBoolean

public IResolvable getBoolean(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getBooleanMap

public java.util.Map<java.lang.String, java.lang.Boolean> getBooleanMap(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getList

public java.util.List<java.lang.String> getList(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getMap

public java.util.Map<java.lang.String, java.lang.Object> getMap(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getNumber

public java.lang.Number getNumber(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getNumberList

public java.util.List<java.lang.Number> getNumberList(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getNumberMap

public java.util.Map<java.lang.String, java.lang.Number> getNumberMap(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getString

public java.lang.String getString(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

getStringMap

public java.util.Map<java.lang.String, java.lang.String> getStringMap(java.lang.String attribute)

attributeRequired

  • Type: java.lang.String
name of the property to retrieve.

keys

public IResolvable keys()
Creates a for expression that maps the iterators to its keys. For lists these would be the indices, for maps the keys. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString.

pluckProperty

public IResolvable pluckProperty(java.lang.String property)
Creates a for expression that accesses the key on each element of the iterator. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString.

propertyRequired

  • Type: java.lang.String
The property of the iterators values to map to.

values

public IResolvable values()
Creates a for expression that maps the iterators to its value in case it is a map. For lists these would stay the same. As this returns an IResolvable you might need to wrap the output in a Token, e.g. Token.asString.

Static Functions

NameDescription
fromComplexListCreates a new iterator from a complex list.
fromDataSourcesCreates a new iterator from a data source that has been created with the for_each argument.
fromListCreates a new iterator from a list.
fromMapCreates a new iterator from a map.
fromResourcesCreates a new iterator from a resource that has been created with the for_each argument.

fromComplexList

import io.cdktn.cdktn.TerraformIterator;

TerraformIterator.fromComplexList(IResolvable|ComplexList|StringMapList|NumberMapList|BooleanMapList|AnyMapList list, java.lang.String mapKeyAttributeName)
Creates a new iterator from a complex list. One example for this would be a list of maps. The list will be converted into a map with the mapKeyAttributeName as the key. Example
// Example automatically generated from non-compiling source. May contain errors.
Object cert = AcmCertificate.Builder.create(this, "cert")
        .domainName("example.com")
        .validationMethod("DNS")
        .build();

Object dvoIterator = TerraformIterator.fromComplexList(cert.getDomainValidationOptions(), "domain_name");

Route53Record.Builder.create(this, "record")
        .allowOverwrite(true)
        .name(dvoIterator.getString("name"))
        .records(List.of(dvoIterator.getString("record")))
        .ttl(60)
        .type(dvoIterator.getString("type"))
        .zoneId(Token.asString(dataAwsRoute53ZoneExample.getZoneId()))
        .forEach(dvoIterator)
        .build();

listRequired

the list to iterate over.

mapKeyAttributeNameRequired

  • Type: java.lang.String
the name of the attribute that should be used as the key in the map. Visit https://developer.hashicorp.com/terraform/cdktf/concepts/iterators#using-iterators-on-complex-lists for more information.

fromDataSources

import io.cdktn.cdktn.TerraformIterator;

TerraformIterator.fromDataSources(ITerraformResource resource)
Creates a new iterator from a data source that has been created with the for_each argument.

resourceRequired


fromList

import io.cdktn.cdktn.TerraformIterator;

TerraformIterator.fromList(java.util.List<java.lang.String>|IResolvable|java.util.List<java.lang.Number>|java.util.List<java.lang.Boolean|IResolvable> list)
Creates a new iterator from a list.

listRequired

  • Type: java.util.List< java.lang.String >|IResolvable|java.util.List< java.lang.Number >|java.util.List<java.lang.Boolean|IResolvable>

fromMap

import io.cdktn.cdktn.TerraformIterator;

TerraformIterator.fromMap(ComplexMap|java.util.Map<java.lang.String, java.lang.Object>|java.util.Map<java.lang.String, java.lang.String>|java.util.Map<java.lang.String, java.lang.Number>|java.util.Map<java.lang.String, java.lang.Boolean> map)
Creates a new iterator from a map.

mapRequired

  • Type: ComplexMap|java.util.Map< java.lang.String, java.lang.Object >|java.util.Map< java.lang.String, java.lang.String >|java.util.Map< java.lang.String, java.lang.Number >|java.util.Map< java.lang.String, java.lang.Boolean >

fromResources

import io.cdktn.cdktn.TerraformIterator;

TerraformIterator.fromResources(ITerraformResource resource)
Creates a new iterator from a resource that has been created with the for_each argument.

resourceRequired