HackedRico
### Expected Behavior When running CDKTF init from a Terraform Project Template in HCL, the generated CDKTF Typescript does not recognize Terraform Lifecycle `ignore_changes` field. <img width="901" height="679" alt="Image" src="https://github.com/user-attachments/assets/adc28209-1817-42c7-be9e-9f8fd6924351" /> ### Actual Behavior Generated CDKTF App properly handles Terraform Lifecycle fields. ### Steps to Reproduce 1. Create a Terraform Project with resources that uses Lifecycle feature. Sample Test Case: ```terraform terraform { required_providers { aws = { source = "hashicorp/aws" version = "6.14.1" } } } provider "aws" { } resource "aws_instance" "example" { ami = "resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64" instance_type = "t3.micro" tags = { Name = "HelloWorld" } lifecycle { ignore_changes = [ tags ] } } ``` 2. Initialize CDKTF from Terraform Project template ```bash cdktf init --template=typescript \ --from-terraform-project=../terraform \ --local \ --providers=aws ``` 3. Observe generated `main.ts` file for invalid lifecycle. ### Versions ```shell cdktf debug language: typescript cdktf-cli: 0.21.0 node: v22.17.1 cdktf: 0.21.0 constructs: 10.4.2 jsii: null terraform: 1.13.0 arch: x64 os: darwin 24.6.0 providers [email protected] (LOCAL) terraform provider version: 6.14.1 @cdktf/provider-aws (PREBUILT) terraform provider version: 6.14.1 prebuilt provider version: 21.11.1 cdktf version: ^0.21.0 ``` ### Providers ```shell ┌───────────────┬──────────────────┬─────────┬────────────┬─────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤ │ aws │ 6.14.1 │ │ 6.14.1 │ │ │ ├───────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤ │ aws │ 6.14.1 │ ^0.21.0 │ │ @cdktf/provider-aws │ 21.11.1 │ └───────────────┴──────────────────┴─────────┴────────────┴─────────────────────┴─────────────────┘``` ``` ### Gist _No response_ ### Possible Solutions From Terraform code converted to Typescript, create Lifecycle fields as String Arrays. The values are recognized, needs conversion to be string values. ### Workarounds Based on the CDKTF Lifecycle Resource defined, it expects an string array. ```typescript export interface TerraformResourceLifecycle { readonly createBeforeDestroy?: boolean; readonly preventDestroy?: boolean; readonly ignoreChanges?: string[] | "all"; readonly replaceTriggeredBy?: Array<ITerraformDependable | string>; readonly precondition?: Precondition[]; readonly postcondition?: Postcondition[]; } ``` Whereas, the CDKTF init from Template does not create an String array. It creates the following: ```typescript lifecycle: { ignoreChanges: [ tags ], }, ``` I changed it to be an String and it worked, after change: ```typescript lifecycle: { ignoreChanges: [ "tags" ], }, ``` ### Anything Else? _No response_ ### References _No response_ ### Help Wanted - [X] I'm interested in contributing a fix myself ### Community Note - Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request - Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request - If you are interested in working on this issue or have submitted a pull request, please leave a comment