Upgrading to CDK for Terraform Version 0.9
0.9 includes improvements to some of our provider code bindings, to improve usage across all languages.
Standardize IResolvable Usage
PR: #1299
This is an effort to make sure attributes can be freely passed between resources for all different types.
There is a minor breaking change:
count
on resources and data sources has gone fromnumber | cdktf.IResolvable
tonumber
. If code was previously passing anIResolvable
, it will now need to wrap theIResolvable
usingToken.asNumber()
on Typescript and Java ,Token.AsNumer()
on C#,cdktf.Token_AsNumber()
on Go, andToken().as_string()
on Python.
Map Tokens
PR: #1411
As part of an effort to use more native types, there are now tokens for maps of primitive values.
As a result, there is a minor breaking change:
- Map attributes have gone from
{ [key: string]: TYPE } | cdktf.IResolvable
to{ [key: string]:TYPE }
whenTYPE
isstring, number, or boolean
.- The most common impact is maps created by using Terraform functions (
Fn.(...)
) will now need to be passed toToken.as<String/Number/Boolean>Map()
before assigning to a resource attribute. The naming is a bit different per language, on C# it'sToken.As<String/Number/Boolean>Map()
, on Go it'scdktf.Token_As<String/Number/Boolean>Map()
, and on Python it'sToken().as_<string/number/boolean>_map()
.
- The most common impact is maps created by using Terraform functions (
Number[] Tokens
PR: #1471
As part of an effort to use more native types, there are now tokens for number[]
.
This is mostly an internal change, but there is now Token.asNumberList()
(on C# it's Token.AsNumberList()
, on Go it's cdktf.Token_AsNumberList
, on Python it's Token().as_number_list()
) which can be used to convert other values into number[]
.
As a result of some standardization, there is a minor breaking change:
- Boolean[] attributes have gone from
boolean[]
toArray<boolean | IResolvable> | IResolvable
.- This is done because neither
boolean
orboolean[]
is representable by a token. - This should make it easier to pass around
boolean[]
between resources and fuctions. - For jsii languages (especially Java and C#), these types will end up as
List<Object>
.
- This is done because neither