Skip to content

Commit

Permalink
Re-enabling compact. It works in local tests and is required for top …
Browse files Browse the repository at this point in the history
…modules to convert

also updates pulumi-std schema to match v1.8.0

Related #65
Fixes pulumi/pulumi#18406
  • Loading branch information
brandonpollack23 committed Feb 5, 2025
1 parent 5dfc97c commit 5f23fc2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Enable lookup which is already in pulumi-std
- Enable merge which is already in pulumi-std
- Enable flatten which is already in pulumi-std
- Reenable "compact" since it is required for many providers.

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"warning:builtin_functions/main.tf:241,11-47:Function not yet implemented:Function coalescelist not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:244,11-39:Function not yet implemented:Function coalescelist not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:247,11-44:Function not yet implemented:Function coalescelist not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:253,11-45:Function not yet implemented:Function compact not yet implemented, see pulumi/pulumi-converter-terraform#65",
"warning:builtin_functions/main.tf:265,11-41:Function not yet implemented:Function contains not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:268,11-41:Function not yet implemented:Function contains not yet implemented, see pulumi/pulumi-converter-terraform#65 (catch all bug)",
"warning:builtin_functions/main.tf:286,11-51:Function not yet implemented:Function distinct not yet implemented, see pulumi/pulumi-converter-terraform#65",
Expand Down
4 changes: 3 additions & 1 deletion pkg/convert/testdata/programs/builtin_functions/pcl/main.pp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@

# Examples for compact
output "funcCompact" {
value = notImplemented("compact([\"a\",\"\",\"b\",null,\"c\"])")
value = invoke("std:index:compact", {
input = ["a", "", "b", null, "c"]
}).result
}


Expand Down
12 changes: 6 additions & 6 deletions pkg/convert/testdata/schemas/std.json
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,13 @@
}
},
"std:index:compact": {
"description": "Removes empty string elements from a list.",
"description": "Removes empty and nil string elements from a list.",
"inputs": {
"properties": {
"input": {
"type": "array",
"items": {
"type": "string"
"$ref": "pulumi.json#/Any"
}
}
},
Expand All @@ -564,16 +564,16 @@
"outputs": {
"properties": {
"result": {
"type": "array",
"items": {
"type": "string"
}
},
"type": "array"
}
},
"type": "object",
"required": [
"result"
]
],
"type": "object"
}
},
"std:index:concat": {
Expand Down
8 changes: 4 additions & 4 deletions pkg/convert/testdata/states/count/import.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"Type": "simple:index:resource",
"Name": "a_resource-0",
"ID": "abc123",
"Name": "a_resource-1",
"ID": "def456",
"LogicalName": "",
"IsComponent": false,
"IsRemote": false,
Expand All @@ -11,8 +11,8 @@
},
{
"Type": "simple:index:resource",
"Name": "a_resource-1",
"ID": "def456",
"Name": "a_resource-0",
"ID": "abc123",
"LogicalName": "",
"IsComponent": false,
"IsRemote": false,
Expand Down
23 changes: 7 additions & 16 deletions pkg/convert/tf.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,21 +487,13 @@ var tfFunctionStd = map[string]struct {
output: "result",
paramArgs: true,
},
/* Currently failing due to: cannot assign expression of type { input: (string, string, string, null,
string) } to location of type { input: list(output(string) | string) | output(list(string)) } | output({
input: list(string) }):
*/
//
// on main.pp line 263:
// 264: value = invoke("std:index:compact", {
// 265: input = ["a", "", "b", null, "c"]
// 266: }).result
//
//"compact": {
// token: "std:index:compact",
// inputs: []string{"input"},
// output: "result",
//},
// TODO issue is this needs to support null
"compact": {
token: "std:index:compact",
inputs: []string{"input"},
output: "result",
paramArgs: true,
},
"cidrhost": {
token: "std:index:cidrhost",
inputs: []string{"input", "host"},
Expand Down Expand Up @@ -3595,7 +3587,6 @@ func componentProgramBinderFromAfero(fs afero.Fs) pcl.ComponentProgramBinder {
var unimplementedFunctionBugs = map[string]string{
"coalesce": "pulumi/pulumi-converter-terraform#65",
"coalescelist": "pulumi/pulumi-converter-terraform#65",
"compact": "pulumi/pulumi-converter-terraform#65",
"distinct": "pulumi/pulumi-converter-terraform#65",
"format": "pulumi/pulumi-converter-terraform#65",
"formatdate": "pulumi/pulumi-converter-terraform#196",
Expand Down

0 comments on commit 5f23fc2

Please sign in to comment.