Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TerraformAsset: Rename path result no such file or directory #3739

Open
1 task
djakielski opened this issue Oct 4, 2024 · 2 comments
Open
1 task

TerraformAsset: Rename path result no such file or directory #3739

djakielski opened this issue Oct 4, 2024 · 2 comments
Labels
bug Something isn't working needs-reproduction

Comments

@djakielski
Copy link

Expected Behavior

I renamed the file orderReader.json to orderReader.asl.json which is used in a TerraformAsset. So it should recreate the asset.

 const file = new TerraformAsset(this, `${id}-definition`, {
            path: path.resolve(__dirname, '../step-functions/orderReader.asl.json'),
            type: AssetType.FILE
});

Actual Behavior

I got an error message

 order-reader % cdktf deploy

⠦  Synthesizing
[2024-10-04T22:05:51.760] [ERROR] default - Error: ENOENT: no such file or directory, stat '/<ProjectPath>/order-reader/step-functions/orderReader.json'
    at Object.statSync (node:fs:1665:25)
    at new TerraformAsset (/<ProjectPath>/order-reader/node_modules/.pnpm/cdktf@0.20.9_constructs@10.3.0/node_modules/cdktf/lib/terraform-asset.ts:78:21)
    at new OrderReaderStepFunction (/<ProjectPath>/order-reader/lib/orderReaderStepFunction.ts:19:22)
    at new OrderReader (/<ProjectPath>/order-reader/main.ts:49:5)
    at Object.<anonymous> (/<ProjectPath>/order-reader/main.ts:58:15)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module.m._compile (<ProjectPath>
node_modules/.pnpm/ts-node@10.9.2_@types+node@22.5.2_typescript@5.5.4/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Object.require.extensions.<computed> [as .ts] (/<ProjectPath>/order-reader/node_modules/.pnpm/ts-node@10.9.2_@types+node@22.5.2_typescript@5.5.4/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1208:32) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/<ProjectPath>/order-reader/step-functions/orderReader.json'
ERROR: cdktf encountered an error while synthesizing

Steps to Reproduce

  1. Create TerraformAsset with a file
  2. Deploy
  3. Rename file and path in Terraform Asset
  4. Redeploy

Versions

cdktf debug
language: typescript
cdktf-cli: 0.20.8
node: v20.15.1
cdktf: 0.20.9
constructs: 10.3.0
jsii: null
terraform: 1.7.2
arch: arm64
os: darwin 24.0.0
providers
sveba/netcupdns@> 1.2 (LOCAL)
terraform provider version: 1.2.0
RutledgePaulV/counters@
> 0.0.5 (LOCAL)
terraform provider version: 0.0.5
@cdktf/provider-aws (PREBUILT)
terraform provider version: 5.65.0
prebuilt provider version: 19.33.0
cdktf version: ^0.20.0

Providers

┌────────────────────────┬──────────────────┬─────────┬────────────┬─────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├────────────────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤
│ sveba/netcupdns │ 1.2.0 │ │ ~> 1.2 │ │ │
├────────────────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤
│ RutledgePaulV/counters │ 0.0.5 │ │ ~> 0.0.5 │ │ │
├────────────────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤
│ aws │ 5.65.0 │ ^0.20.0 │ │ @cdktf/provider-aws │ 19.33.0 │
└────────────────────────┴──────────────────┴─────────┴────────────┴─────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

I guess cdktf use remote state value instead of value from code.

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction 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
@djakielski djakielski added bug Something isn't working new Un-triaged issue labels Oct 4, 2024
@ansgarm
Copy link
Member

ansgarm commented Oct 7, 2024

Hi @djakielski 👋

Does deleting the cdktf.out directory maybe resolve this? Of course this would just be a temporary workaround but it could also guide us to the root problem since it seems it's running on stale configuration.

@ansgarm ansgarm added needs-reproduction and removed new Un-triaged issue labels Oct 7, 2024
@djakielski
Copy link
Author

HI @ansgarm 👋

I delete it several times without result. Maybe it relates to #3727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-reproduction
Projects
None yet
Development

No branches or pull requests

2 participants