Skip to content

Commit

Permalink
refactor(lib): use Token.isUnresolved instead of new method
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Oct 27, 2021
1 parent a4fe377 commit 7e79efd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cdktf/lib/terraform-element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from "constructs";
import { Tokenization } from ".";
import { Token } from ".";
import { TerraformStack } from "./terraform-stack";

export interface TerraformElementMetadata {
Expand All @@ -20,7 +20,7 @@ export class TerraformElement extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);

if (Tokenization.containsToken(id)) {
if (Token.isUnresolved(id)) {
throw new Error(
"You cannot use a Token (e.g. a reference to an attribute) as the id of a construct"
);
Expand Down
4 changes: 0 additions & 4 deletions packages/cdktf/lib/tokens/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ export class Tokenization {
return [];
}

public static containsToken(x: any): boolean {
return Tokenization.reverse(x).length > 0;
}

/**
* Un-encode a string potentially containing encoded tokens
*/
Expand Down

0 comments on commit 7e79efd

Please sign in to comment.