Skip to content

Commit

Permalink
Enable tobool in pulumi-converter-terraform, already implemented in p…
Browse files Browse the repository at this point in the history
…ulumi-std
  • Loading branch information
brandonpollack23 committed Jan 31, 2025
1 parent 17d3778 commit 2b3451a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 19 deletions.
22 changes: 15 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 31790
}
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 31790
},
{
"name": "builtin_functions",
"type": "go",
"request": "launch",
"mode": "test",
"program": "./pkg/convert/translate_test.go",
"args": ["-test.run=TestTranslate/builtin_functions"]
}
]
}
4 changes: 3 additions & 1 deletion CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Improvements

- Allow generating of tobool invocation.

### Bug Fixes

- Require v0.6.0 of the `terraform-provider` instead of v0.5.4 because the latter is no longer available.
- Require v0.6.0 of the `terraform-provider` instead of v0.5.4 because the latter is no longer available.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@
"warning:builtin_functions/main.tf:940,11-949,16:Function not yet implemented:Function templatefile not yet implemented, see pulumi/pulumi-converter-terraform#192",
"warning:builtin_functions/main.tf:955,11-75:Function not yet implemented:Function textdecodebase64 not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:961,11-54:Function not yet implemented:Function textencodebase64 not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:1000,11-23:Function not yet implemented:Function tobool not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:1003,11-25:Function not yet implemented:Function tobool not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:1006,11-23:Function not yet implemented:Function tobool not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:1009,11-23:Function not yet implemented:Function tobool not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:1012,11-20:Function not yet implemented:Function tobool not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:1027,11-36:Function not yet implemented:Function tomap not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:1030,11-43:Function not yet implemented:Function tomap not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:1036,11-22:Function not yet implemented:Function tonumber not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
Expand Down
20 changes: 15 additions & 5 deletions pkg/convert/testdata/programs/builtin_functions/pcl/main.pp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,19 +1377,29 @@

# Examples for tobool
output "funcTobool0" {
value = notImplemented("tobool(true)")
value = invoke("std:index:tobool", {
input = true
}).result
}
output "funcTobool1" {
value = notImplemented("tobool(\"true\")")
value = invoke("std:index:tobool", {
input = "true"
}).result
}
output "funcTobool2" {
value = notImplemented("tobool(null)")
value = invoke("std:index:tobool", {
input = null
}).result
}
output "funcTobool3" {
value = notImplemented("tobool(\"no\")")
value = invoke("std:index:tobool", {
input = "no"
}).result
}
output "funcTobool4" {
value = notImplemented("tobool(1)")
value = invoke("std:index:tobool", {
input = 1
}).result
}


Expand Down
6 changes: 5 additions & 1 deletion pkg/convert/tf.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,11 @@ var tfFunctionStd = map[string]struct {
inputs: []string{"input"},
output: "result",
},
"tobool": {
token: "std:index:tobool",
inputs: []string{"input"},
output: "result",
},
"transpose": {
token: "std:index:transpose",
inputs: []string{"input"},
Expand Down Expand Up @@ -3581,7 +3586,6 @@ var unimplementedFunctionBugs = map[string]string{
"regexall": "pulumi/pulumi-converter-terraform#191",
"slice": "pulumi/pulumi-converter-terraform#65",
"templatefile": "pulumi/pulumi-converter-terraform#192",
"tobool": "pulumi/pulumi-converter-terraform#65",
"toset": "pulumi/pulumi-converter-terraform#137",
"try": "pulumi/pulumi-converter-terraform#16",
"yamlencode": "pulumi/pulumi-converter-terraform#190",
Expand Down

0 comments on commit 2b3451a

Please sign in to comment.