From c91ca66a7b40f5e94141ff705e62ba33956e462b Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Tue, 5 Dec 2023 14:12:25 +0100 Subject: [PATCH] fix(lib): Don't require a provider block for built-in terraform provider --- .../cdktf/lib/validations/validate-provider-presence.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cdktf/lib/validations/validate-provider-presence.ts b/packages/cdktf/lib/validations/validate-provider-presence.ts index 3c46c243f3..55ff16eb16 100644 --- a/packages/cdktf/lib/validations/validate-provider-presence.ts +++ b/packages/cdktf/lib/validations/validate-provider-presence.ts @@ -1,6 +1,6 @@ // Copyright (c) HashiCorp, Inc // SPDX-License-Identifier: MPL-2.0 -import { IConstruct, IValidation, Node } from "constructs"; +import { IConstruct, IValidation } from "constructs"; import { TerraformProvider } from "../terraform-provider"; import { TerraformResource } from "../terraform-resource"; import { TerraformDataSource } from "../terraform-data-source"; @@ -33,7 +33,10 @@ export class ValidateProviderPresence implements IValidation { TerraformResource.isTerraformResource(node) || TerraformDataSource.isTerraformDataSource(node) ) { - if (node.terraformGeneratorMetadata) { + if ( + node.terraformGeneratorMetadata && + node.terraformGeneratorMetadata.providerName !== "terraform" + ) { this.providerNames.add(node.terraformGeneratorMetadata.providerName); } } @@ -42,7 +45,7 @@ export class ValidateProviderPresence implements IValidation { this.foundProviders.push(node); } - for (const child of Node.of(node).children) { + for (const child of node.node.children) { this.check(child); } }