From 71cb857b7d4be436f3ba8f03c40f4d3b47649fd5 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Thu, 5 Oct 2023 09:42:26 -0400 Subject: [PATCH] chore: add validations for proper terrafrom version --- packages/cdktf/lib/terraform-resource.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/cdktf/lib/terraform-resource.ts b/packages/cdktf/lib/terraform-resource.ts index 1e1bb742f0..627b5f1de6 100644 --- a/packages/cdktf/lib/terraform-resource.ts +++ b/packages/cdktf/lib/terraform-resource.ts @@ -307,7 +307,12 @@ export class TerraformResource : `${this.terraformResourceType}.${resourceToMoveTo.friendlyUniqueId}`; const movedFromId = `${this.terraformResourceType}.${this.friendlyUniqueId}`; this._moved = { to: movedToId, from: movedFromId, renamed: false }; - // TODO: add validation of correct Terraform Version + this.node.addValidation( + new ValidateTerraformVersion( + ">=1.5", + `Resource move functionality is only supported for Terraform >=1.5. Please upgrade your Terraform version.` + ) + ); } /** @@ -340,5 +345,9 @@ export class TerraformResource from: `${this.terraformResourceType}.${oldUniqueId}`, renamed: true, }; + new ValidateTerraformVersion( + ">=1.5", + `Resource rename functionality is only supported for Terraform >=1.5. Please upgrade your Terraform version.` + ); } }