From 0f1e6943c73f93986257ffeb361a03313b87df04 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Wed, 14 Aug 2024 17:30:16 +0200 Subject: [PATCH] Fix tf2pulumi renames This PR moves an invalid mapping in the `pkg/tf2pulumi/convert/testdata/mappings/renames.json` to a valid mapping. You can see the newly valid mapping take effect in the schema file: `pkg/tf2pulumi/convert/testdata/schemas/renames.json`. This PR exposes a bug where tf2pulumi doesn't properly propagate `MaxItems: 1` information. The bug is shown in the changes in `pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp`. --- pkg/tf2pulumi/convert/testdata/mappings/renames.json | 8 +++++--- pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp | 4 ++-- pkg/tf2pulumi/convert/testdata/schemas/renames.json | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/tf2pulumi/convert/testdata/mappings/renames.json b/pkg/tf2pulumi/convert/testdata/mappings/renames.json index 6eb346ca8..e6497cca8 100644 --- a/pkg/tf2pulumi/convert/testdata/mappings/renames.json +++ b/pkg/tf2pulumi/convert/testdata/mappings/renames.json @@ -82,9 +82,11 @@ }, "a_resource": { "name": "theResource", - "fields": { - "inner_string": { - "name": "theInnerString" + "element": { + "fields": { + "inner_string": { + "name": "theInnerString" + } } } }, diff --git a/pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp b/pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp index 876061612..97bd91e8d 100644 --- a/pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp +++ b/pkg/tf2pulumi/convert/testdata/renames/pcl/main.pp @@ -1,7 +1,7 @@ resource aResource "renames:index/index:resource" { theNumber = 1 theResource = { - theInnerString = "hello" + innerString = "hello" } } output someOutputA { @@ -34,6 +34,6 @@ } theNumber = 1 theResource = { - theInnerString = "hello" + innerString = "hello" } } diff --git a/pkg/tf2pulumi/convert/testdata/schemas/renames.json b/pkg/tf2pulumi/convert/testdata/schemas/renames.json index 7edac8fa3..d600f0ae2 100644 --- a/pkg/tf2pulumi/convert/testdata/schemas/renames.json +++ b/pkg/tf2pulumi/convert/testdata/schemas/renames.json @@ -28,7 +28,7 @@ }, "renames:index/resourceTheResource:resourceTheResource": { "properties": { - "innerString": { + "theInnerString": { "type": "string" } },