constructs version 10. If you are using more advanced APIs from the constructs library, refer to the Constructs API Changes section.
Background
Since version 0.6 thecdktf package depends on constructs v10 (formerly was v3). While that jump might look big, v10 is actually going to be the next major version after v3. We made this change because the constructs lib v10 is supposed to stay around for a while and is supposed to offer a very stable API.
To achieve this stability in the core functionality a lot has been removed from v10. For further background information you can read into the PR for v10 or the AWS CDK RFC Removal of Construct Compatibility Layer.
While using the v0.6 cdktf-cli to deploy stacks that are using an older version of cdktf and constructs should still work, we recommend upgrading the cdktf and constructs packages.
Pre-built providers
All upcoming releases of the pre-built providers will depend onconstructs v10. So we recommend to upgrade your project.
If you cannot upgrade the cdktf version, you can switch to generating provider bindings via cdktf get.
Upgrading a TypeScript / JavaScript CDKTF project
To upgrade a TypeScript or JavaScript CDKTF project, adjust the versions in thepackage.json file of your project.
npm install to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
Upgrading a Python CDKTF project
pipenv (python-template)
To upgrade a Python CDKTF project using pipenv, adjust the versions in the Pipfile of your project.
pipenv install to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
Pip3 (python-pip-template)
To upgrade a Python CDKTF project using pip3, adjust the versions in the requirements.txt of your project.
pip3 install -r requirements.txt to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
Upgrading a Java CDKTF project
To upgrade a Java CDKTF project, adjust the versions in thepom.xml file of your project.
mvn install to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
Upgrading a CSharp CDKTF project
To upgrade a C# CDKTF project, adjust the versions in the*.csproj file of your project.
dotnet restore to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
Upgrading a Golang CDKTF project
To upgrade a Golang CDKTF project, adjust the versions in thego.mod file of your project.
go get to update the depedencies and cdktf get to re-generate the provider bindings if you don’t only use pre-built providers.
You also need to adjust all imports to refer to constructs/v10 instead of constructs/v3.
Constructs API Changes
Aspects moved to cdktf
Aspects are now part of cdktf as they’ve been removed from constructs. If you use them, you need to change your import statement to import them from the cdktf package. The API also has changed a bit:
construct.node.addInfo() / addWarning() / addError() moved to Annotations
The aforementioned methods are now available via the Annotations API:
cdktf-cli after your stack was synthesized. One ore more error annotations will make the synth fail.