You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/cdktf/concepts/tokens.mdx
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ You may need to use Tokens for:
21
21
-[Module outputs](/terraform/cdktf/concepts/modules) for boolean, string, lists, maps, and other complex types.
22
22
- Resource attributes (such as `id`).
23
23
- Terraform outputs based on resource attributes.
24
-
- Using Terraforms`null` type.
24
+
- Using Terraform's`null` type and [terraform.workspace](/terraform/language/state/workspaces#current-workspace-interpolation).
25
25
26
26
### Example
27
27
@@ -216,3 +216,51 @@ cdktf.Token_NullValue()
216
216
```
217
217
218
218
</CodeTabs>
219
+
220
+
### Using `terraform.workspace`
221
+
222
+
In the code below, the outer `Token.as_number()` avoids:
223
+
224
+
> TypeError: type of argument count must be one of (int, float, cdktf.TerraformCount, NoneType); got jsii.\_reference_map.InterfaceDynamicProxy instead
225
+
226
+
The inner `Token.as_any()` avoids generating extra quotes `"terraform.workspace"` and extra dollar signs `"$${terraform.workspace}"`.
0 commit comments