-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: bring tfresource
- custom terraform resources
#35
Conversation
Introduce a library that can be used to create custom resources for Terraform.
tfresource
- custom terraform resourcestfresource
- custom terraform resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty cool! Tested it both for sim
and tf-aws
. Works both as expected for normal compilation. When using wing test
, it works on sim
only since tf-aws
will try to run it in a Lambda function.
2023-12-14T09:45:10.616+01:00 INIT_START Runtime Version: nodejs:18.v18 Runtime Version ARN: arn:aws:lambda:eu-central-1::runtime:5b65a6230d1054ba2f3bcff29fe7654ff1a5453cd2cfa1a03367a850c540a9da
2023-12-14T09:45:10.834+01:00 START RequestId: c30921df-2488-4aeb-ac61-2c83e7b9764c Version: $LATEST
2023-12-14T09:45:10.875+01:00 /bin/sh: wing: command not found
2023-12-14T09:45:11.014+01:00 2023-12-14T08:45:11.014Z c30921df-2488-4aeb-ac61-2c83e7b9764c ERROR Invoke Error {"errorType":"Error","errorMessage":"Command failed: wing compile -t tf-aws examples/file.main.w","status":127,"signal":null,"output":[null,{"type":"Buffer","data":[]},null],"pid":23,"stdout":{"type":"Buffer","data":[]},"stderr":null,"stack":["Error: Command failed: wing compile -t tf-aws examples/file.main.w"," at __node_internal_genericNodeError (node:internal/errors:865:15)"," at checkExecSyncError (node:child_process:890:11)"," at execSync (node:child_process:962:15)"," at Object.exports2.shell (/Users/sebastian/projects/wing-cloud/winglibs/tfresource/target/test/lib.test.tfaws/.wing/../../../../util.js:4:18)"," at Function.shell (/Users/sebastian/projects/wing-cloud/winglibs/tfresource/target/test/lib.test.tfaws/.wing/../../../../lib.test.w:10:48)"," at $Closure1.handle (/Users/sebastian/projects/wing-cloud/winglibs/tfresource/target/test/lib.test.tfaws/.wing/../../../../lib.test.w:14:3)"," at Runtime.exports.handler (/Users/sebastian/projects/wing-cloud/winglibs/tfresource/target/test/lib.test.tfaws/.wing/handler_c85b802b.js:20:11)"]}
2023-12-14T09:45:11.035+01:00 END RequestId: c30921df-2488-4aeb-ac61-2c83e7b9764c
2023-12-14T09:45:11.035+01:00 REPORT RequestId: c30921df-2488-4aeb-ac61-2c83e7b9764c Duration: 198.69 ms Billed Duration: 199 ms Memory Size: 1024 MB Max Memory Used: 90 MB Init Duration: 215.49 ms
So this can't be used as part of wing tests for other targets than sim
as it is right now. Not sure if there's an easy workaround for this.
also, wondering if there's a way for richer diffs. Applied the example and changed the content of one of the files. That's the diff:
Terraform will perform the following actions:
# shell_script.hello_tfrTerraformResource_Shell_8D678384 must be replaced
-/+ resource "shell_script" "hello_tfrTerraformResource_Shell_8D678384" {
~ dirty = true -> false # forces replacement
~ id = "cltc4ldg322nb2d9k18g" -> (known after apply)
~ output = {
- "hash" = "9e189ad1eb128bfd032968943f323dcf788fd6641cdc7ebddb72a3fa49aceb0f"
- "path" = "hello1.txt"
} -> (known after apply)
# (1 unchanged attribute hidden)
# (1 unchanged block hidden)
}
tfresource
- custom terraform resourcesbring tfresource
- custom terraform resources
- Updates wing to the latest version in each winglib. - Adds a script to update wing (would be nice to do it in a cron job).
Looks like the global require of this file introduced in winglang/wing#5306 breaks the current approach. When running it I get
tried to install Ideas for workarounds? |
Hi, This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. |
Hi, This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. |
Introduce a library that can be used to create custom resources for Terraform.