Skip to content

Commit

Permalink
chore: add validations for proper terrafrom version
Browse files Browse the repository at this point in the history
  • Loading branch information
Maed223 committed Oct 5, 2023
1 parent cdb0f8f commit 71cb857
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/cdktf/lib/terraform-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
)
);
}

/**
Expand Down Expand Up @@ -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.`
);
}
}

0 comments on commit 71cb857

Please sign in to comment.