Skip to main content

Initializers

using Io.Cdktn;

new DynamicListTerraformIterator(string[]|IResolvable|double[]|(bool|IResolvable)[] List, string MapKeyAttributeName);
NameTypeDescription
Liststring[]|IResolvable|double[]|bool|IResolvable[]No description.
MapKeyAttributeNamestringNo description.

ListRequired


MapKeyAttributeNameRequired

  • Type: string

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

private IResolvable Dynamic(System.Collections.Generic.IDictionary<string, 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: System.Collections.Generic.IDictionary< string, object >

ForExpressionForList

private IResolvable ForExpressionForList(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

private IResolvable ForExpressionForMap(string|IResolvable KeyExpression, 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

private IResolvable GetAny(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetAnyMap

private System.Collections.Generic.IDictionary<string, object> GetAnyMap(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetBoolean

private IResolvable GetBoolean(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetBooleanMap

private System.Collections.Generic.IDictionary<string, bool> GetBooleanMap(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetList

private string[] GetList(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetMap

private System.Collections.Generic.IDictionary<string, object> GetMap(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetNumber

private double GetNumber(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetNumberList

private double[] GetNumberList(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetNumberMap

private System.Collections.Generic.IDictionary<string, double> GetNumberMap(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetString

private string GetString(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

GetStringMap

private System.Collections.Generic.IDictionary<string, string> GetStringMap(string Attribute)

AttributeRequired

  • Type: string
name of the property to retrieve.

Keys

private 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

private IResolvable PluckProperty(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: string
The property of the iterators values to map to.

Values

private 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

using Io.Cdktn;

DynamicListTerraformIterator.FromComplexList(IResolvable|ComplexList|StringMapList|NumberMapList|BooleanMapList|AnyMapList List, 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.
var cert = new AcmCertificate(this, "cert", new Struct {
    DomainName = "example.com",
    ValidationMethod = "DNS"
});

var dvoIterator = TerraformIterator.FromComplexList(cert.DomainValidationOptions, "domain_name");

new Route53Record(this, "record", new Struct {
    AllowOverwrite = true,
    Name = dvoIterator.GetString("name"),
    Records = new [] { dvoIterator.GetString("record") },
    Ttl = 60,
    Type = dvoIterator.GetString("type"),
    ZoneId = Token.AsString(dataAwsRoute53ZoneExample.ZoneId),
    ForEach = dvoIterator
});

ListRequired

the list to iterate over.

MapKeyAttributeNameRequired

  • Type: 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

using Io.Cdktn;

DynamicListTerraformIterator.FromDataSources(ITerraformResource Resource);
Creates a new iterator from a data source that has been created with the for_each argument.

ResourceRequired


FromList

using Io.Cdktn;

DynamicListTerraformIterator.FromList(string[]|IResolvable|double[]|(bool|IResolvable)[] List);
Creates a new iterator from a list.

ListRequired


FromMap

using Io.Cdktn;

DynamicListTerraformIterator.FromMap(ComplexMap|System.Collections.Generic.IDictionary<string, object>|System.Collections.Generic.IDictionary<string, string>|System.Collections.Generic.IDictionary<string, double>|System.Collections.Generic.IDictionary<string, bool> Map);
Creates a new iterator from a map.

MapRequired

  • Type: ComplexMap|System.Collections.Generic.IDictionary< string, object >|System.Collections.Generic.IDictionary< string, string >|System.Collections.Generic.IDictionary< string, double >|System.Collections.Generic.IDictionary< string, bool >

FromResources

using Io.Cdktn;

DynamicListTerraformIterator.FromResources(ITerraformResource Resource);
Creates a new iterator from a resource that has been created with the for_each argument.

ResourceRequired


Properties

NameTypeDescription
KeystringReturns the key of the current entry in the map that is being iterated over.
ValueobjectReturns the value of the current item iterated over.

KeyRequired

public string Key { get; }
  • Type: string
Returns the key of the current entry in the map that is being iterated over.

ValueRequired

public object Value { get; }
  • Type: object
Returns the value of the current item iterated over.