Skip to content

Commit

Permalink
fix(lib): Don't require a provider block for built-in terraform provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm committed Dec 7, 2023
1 parent fab5d1a commit c91ca66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/cdktf/lib/validations/validate-provider-presence.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit c91ca66

Please sign in to comment.