Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): add 0.9 upgrade guide #1512

Merged
merged 3 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions website/docs/cdktf/release/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We release CDK for Terraform (CDKTF) regularly. The [CHANGELOG on Github](https:

CDKTF includes upgrade guides for releases that have breaking changes.

- [Upgrading to v0.9](/cdktf/release/upgrade-guide-v0-9)
- [Upgrading to v0.7](/cdktf/release/upgrade-guide-v0-7)
- [Upgrading to v0.6](/cdktf/release/upgrade-guide-v0-6)

Expand Down
38 changes: 38 additions & 0 deletions website/docs/cdktf/release/upgrade-guide-v0-9.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
page_title: Upgrading to CDKTF Version 0.9
description: >-
We changed some provider bindings to work better across all languages.
---

# Upgrading to CDK for Terraform Version 0.9

We changed some provider bindings to work better across all languages.

### Standardize IResolvable Usage [#1299](https://github.com/hashicorp/terraform-cdk/pull/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 from `number | cdktf.IResolvable` to `number`. If code was previously passing an `IResolvable`, it will now need to wrap the `IResolvable` using `Token.asNumber()` on Typescript and Java , `Token.AsNumer()` on C#, `cdktf.Token_AsNumber()` on Go, and `Token().as_string()` on Python.

### Map Tokens [#1411](https://github.com/hashicorp/terraform-cdk/pull/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 }` when `TYPE` is `string, number, or boolean`.
- The most common impact is maps created by using Terraform functions (`Fn.(...)`) will now need to be passed to `Token.as<String/Number/Boolean>Map()` before assigning to a resource attribute. The naming is a bit different per language, on C# it's `Token.As<String/Number/Boolean>Map()`, on Go it's `cdktf.Token_As<String/Number/Boolean>Map()`, and on Python it's `Token().as_<string/number/boolean>_map()`.

### Number[] Tokens [#1471](https://github.com/hashicorp/terraform-cdk/pull/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[]` to `Array<boolean | IResolvable> | IResolvable`.
- This is done because neither `boolean` or `boolean[]` 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>`.