diff --git a/mmv1/third_party/cai2hcl/common/converter_factory.go b/mmv1/third_party/cai2hcl/common/converter_factory.go deleted file mode 100644 index e4bec63d3184..000000000000 --- a/mmv1/third_party/cai2hcl/common/converter_factory.go +++ /dev/null @@ -1,21 +0,0 @@ -package common - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/provider" -) - -// Function initializing a converter from TF resource name and TF resource schema. -type ConverterFactory = func(name string, schema map[string]*schema.Schema) Converter - -// Initializes map of converters. -func CreateConverterMap(converterFactories map[string]ConverterFactory) map[string]Converter { - tpgProvider := tpg.Provider() - - result := make(map[string]Converter, len(converterFactories)) - for name, factory := range converterFactories { - result[name] = factory(name, tpgProvider.ResourcesMap[name].Schema) - } - - return result -} diff --git a/mmv1/third_party/cai2hcl/common/hcl_write.go b/mmv1/third_party/cai2hcl/common/hcl_write.go index c14b67401f99..70684f9feb6d 100644 --- a/mmv1/third_party/cai2hcl/common/hcl_write.go +++ b/mmv1/third_party/cai2hcl/common/hcl_write.go @@ -3,10 +3,26 @@ package common import ( "fmt" + "github.com/hashicorp/hcl/hcl/printer" "github.com/hashicorp/hcl/v2/hclwrite" "github.com/zclconf/go-cty/cty" ) +// HclWriteBlocks prints HCLResourceBlock objects as string. +func HclWriteBlocks(blocks []*HCLResourceBlock) ([]byte, error) { + f := hclwrite.NewFile() + rootBody := f.Body() + + for _, resourceBlock := range blocks { + hclBlock := rootBody.AppendNewBlock("resource", resourceBlock.Labels) + if err := hclWriteBlock(resourceBlock.Value, hclBlock.Body()); err != nil { + return nil, err + } + } + + return printer.Format(f.Bytes()) +} + func hclWriteBlock(val cty.Value, body *hclwrite.Body) error { if val.IsNull() { return nil diff --git a/mmv1/third_party/cai2hcl/common/utils.go b/mmv1/third_party/cai2hcl/common/utils.go index cac4204eec2f..eab0490a86df 100644 --- a/mmv1/third_party/cai2hcl/common/utils.go +++ b/mmv1/third_party/cai2hcl/common/utils.go @@ -5,16 +5,13 @@ import ( "fmt" "strings" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/caiasset" hashicorpcty "github.com/hashicorp/go-cty/cty" - "github.com/hashicorp/hcl/hcl/printer" - "github.com/hashicorp/hcl/v2/hclwrite" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" ) -// Extracts named part from resource url. +// ParseFieldValue extracts named part from resource url. func ParseFieldValue(url string, name string) string { fragments := strings.Split(url, "/") for ix, item := range fragments { @@ -25,7 +22,7 @@ func ParseFieldValue(url string, name string) string { return "" } -// Decodes the map object into the target struct. +// DecodeJSON decodes the map object into the target struct. func DecodeJSON(data map[string]interface{}, v interface{}) error { b, err := json.Marshal(data) if err != nil { @@ -37,12 +34,13 @@ func DecodeJSON(data map[string]interface{}, v interface{}) error { return nil } -// Converts resource from untyped map format to TF JSON. +// MapToCtyValWithSchema converts resource from untyped map format to TF JSON. func MapToCtyValWithSchema(m map[string]interface{}, s map[string]*schema.Schema) (cty.Value, error) { b, err := json.Marshal(&m) if err != nil { return cty.NilVal, fmt.Errorf("error marshaling map as JSON: %v", err) } + ty, err := hashicorpCtyTypeToZclconfCtyType(schema.InternalMap(s).CoreConfigSchema().ImpliedType()) if err != nil { return cty.NilVal, fmt.Errorf("error casting type: %v", err) @@ -54,44 +52,6 @@ func MapToCtyValWithSchema(m map[string]interface{}, s map[string]*schema.Schema return ret, nil } -func Convert(assets []*caiasset.Asset, converterNames map[string]string, converterMap map[string]Converter) ([]byte, error) { - // Group resources from the same tf resource type for convert. - // tf -> cai has 1:N mappings occasionally - groups := make(map[string][]*caiasset.Asset) - for _, asset := range assets { - name, ok := converterNames[asset.Type] - if !ok { - continue - } - groups[name] = append(groups[name], asset) - } - - f := hclwrite.NewFile() - rootBody := f.Body() - for name, v := range groups { - converter, ok := converterMap[name] - if !ok { - continue - } - items, err := converter.Convert(v) - if err != nil { - return nil, err - } - - for _, resourceBlock := range items { - hclBlock := rootBody.AppendNewBlock("resource", resourceBlock.Labels) - if err := hclWriteBlock(resourceBlock.Value, hclBlock.Body()); err != nil { - return nil, err - } - } - if err != nil { - return nil, err - } - } - - return printer.Format(f.Bytes()) -} - func hashicorpCtyTypeToZclconfCtyType(t hashicorpcty.Type) (cty.Type, error) { b, err := json.Marshal(t) if err != nil { diff --git a/mmv1/third_party/cai2hcl/common/utils_test.go b/mmv1/third_party/cai2hcl/common/utils_test.go new file mode 100644 index 000000000000..4d74ce7e93b7 --- /dev/null +++ b/mmv1/third_party/cai2hcl/common/utils_test.go @@ -0,0 +1,42 @@ +package common + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + tpg_provider "github.com/hashicorp/terraform-provider-google-beta/google-beta/provider" +) + +func TestSubsetOfFieldsMapsToCtyValue(t *testing.T) { + schema := createSchema("google_compute_forwarding_rule") + + outputMap := map[string]interface{}{ + "name": "forwarding-rule-1", + } + + val, err := MapToCtyValWithSchema(outputMap, schema) + + assert.Nil(t, err) + assert.Equal(t, "forwarding-rule-1", val.GetAttr("name").AsString()) +} + +func TestWrongFieldTypeBreaksConversion(t *testing.T) { + resourceSchema := createSchema("google_compute_backend_service") + outputMap := map[string]interface{}{ + "name": "fr-1", + "description": []string{"unknownValue"}, // string is required, not array. + } + + val, err := MapToCtyValWithSchema(outputMap, resourceSchema) + + assert.True(t, val.IsNull()) + assert.Contains(t, err.Error(), "string is required") +} + +func createSchema(name string) map[string]*schema.Schema { + provider := tpg_provider.Provider() + + return provider.ResourcesMap[name].Schema +} diff --git a/mmv1/third_party/cai2hcl/convert.go b/mmv1/third_party/cai2hcl/convert.go index c1983f052775..525a6da0ba39 100644 --- a/mmv1/third_party/cai2hcl/convert.go +++ b/mmv1/third_party/cai2hcl/convert.go @@ -15,13 +15,38 @@ type Options struct { ErrorLogger *zap.Logger } -// Converts CAI Assets into HCL. +// Converts CAI Assets into HCL string. func Convert(assets []*caiasset.Asset, options *Options) ([]byte, error) { if options == nil || options.ErrorLogger == nil { return nil, fmt.Errorf("logger is not initialized") } - t, err := common.Convert(assets, ConverterNames, ConverterMap) + // Group resources from the same TF resource type for convert. + // tf -> cai has 1:N mappings occasionally + groups := make(map[string][]*caiasset.Asset) + for _, asset := range assets { + + name, _ := AssetTypeToConverter[asset.Type] + if name != "" { + groups[name] = append(groups[name], asset) + } + } + + allBlocks := []*common.HCLResourceBlock{} + for name, assets := range groups { + converter, ok := ConverterMap[name] + if !ok { + continue + } + newBlocks, err := converter.Convert(assets) + if err != nil { + return nil, err + } + + allBlocks = append(allBlocks, newBlocks...) + } + + t, err := common.HclWriteBlocks(allBlocks) options.ErrorLogger.Debug(string(t)) diff --git a/mmv1/third_party/cai2hcl/convert_test.go b/mmv1/third_party/cai2hcl/convert_test.go index 18ca6a9ba26e..1489446d8ad3 100644 --- a/mmv1/third_party/cai2hcl/convert_test.go +++ b/mmv1/third_party/cai2hcl/convert_test.go @@ -1,17 +1,14 @@ -package cai2hcl +package cai2hcl_test import ( "testing" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/services/compute" cai2hclTesting "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/testing" ) func TestConvertCompute(t *testing.T) { cai2hclTesting.AssertTestFiles( t, - ConverterNames, ConverterMap, "./services/compute/testdata", []string{ "full_compute_instance", @@ -21,40 +18,8 @@ func TestConvertCompute(t *testing.T) { func TestConvertResourcemanager(t *testing.T) { cai2hclTesting.AssertTestFiles( t, - ConverterNames, ConverterMap, "./services/resourcemanager/testdata", []string{ "project_create", }) } - -func TestConvertPanicsOnConverterNamesConflict(t *testing.T) { - assertPanic(t, func() { - joinConverterNames([]map[string]string{ - {"compute.googleapis.com/Instance": "compute_instance_1"}, - {"compute.googleapis.com/Instance": "compute_instance_2"}, - }) - }) -} - -func TestConvertPanicsOnConverterMapConflict(t *testing.T) { - assertPanic(t, func() { - joinConverterMaps([]map[string]common.Converter{ - common.CreateConverterMap(map[string]common.ConverterFactory{ - "google_compute_instance": compute.NewComputeInstanceConverter, - }), - common.CreateConverterMap(map[string]common.ConverterFactory{ - "google_compute_instance": compute.NewComputeForwardingRuleConverter, - }), - }) - }) -} - -func assertPanic(t *testing.T, f func()) { - defer func() { - if r := recover(); r == nil { - t.Errorf("The code did not panic") - } - }() - f() -} diff --git a/mmv1/third_party/cai2hcl/converter_map.go b/mmv1/third_party/cai2hcl/converter_map.go index cf66000d221e..7ea9416fcc2a 100644 --- a/mmv1/third_party/cai2hcl/converter_map.go +++ b/mmv1/third_party/cai2hcl/converter_map.go @@ -4,49 +4,25 @@ import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/services/compute" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/services/resourcemanager" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + tpg_provider "github.com/hashicorp/terraform-provider-google-beta/google-beta/provider" ) -var allConverterNames = []map[string]string{ - compute.ConverterNames, - resourcemanager.ConverterNames, -} - -var allConverterMaps = []map[string]common.Converter{ - compute.ConverterMap, - resourcemanager.ConverterMap, -} - -var ConverterNames = joinConverterNames(allConverterNames) -var ConverterMap = joinConverterMaps(allConverterMaps) +var provider *schema.Provider = tpg_provider.Provider() -func joinConverterNames(arr []map[string]string) map[string]string { - result := make(map[string]string) +// AssetTypeToConverter is a mapping from Asset Type to converter instance. +var AssetTypeToConverter = map[string]string{ + compute.ComputeInstanceAssetType: "google_compute_instance", + compute.ComputeForwardingRuleAssetType: "google_compute_forwarding_rule", - for _, m := range arr { - for key, value := range m { - if _, hasKey := result[key]; hasKey { - panic("Converters from different services are not unique") - } - - result[key] = value - } - } - - return result + resourcemanager.ProjectAssetType: "google_project", + resourcemanager.ProjectBillingAssetType: "google_project", } -func joinConverterMaps(arr []map[string]common.Converter) map[string]common.Converter { - result := make(map[string]common.Converter) - - for _, m := range arr { - for key, value := range m { - if _, hasKey := result[key]; hasKey { - panic("Converters from different services are not unique") - } - - result[key] = value - } - } +// ConverterMap is a collection of converters instances, indexed by name. +var ConverterMap = map[string]common.Converter{ + "google_compute_instance": compute.NewComputeInstanceConverter(provider), + "google_compute_forwarding_rule": compute.NewComputeForwardingRuleConverter(provider), - return result + "google_project": resourcemanager.NewProjectConverter(provider), } diff --git a/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule.go b/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule.go index c821ebb52f43..9d4c316aa8dd 100644 --- a/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule.go +++ b/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule.go @@ -10,9 +10,12 @@ import ( computeV1 "google.golang.org/api/compute/v1" ) -// ComputeForwardingRuleAssetType is the CAI asset type name for compute instance. +// ComputeForwardingRuleAssetType is a CAI asset type name. const ComputeForwardingRuleAssetType string = "compute.googleapis.com/ForwardingRule" +// ComputeForwardingRuleSchemaName is a TF resource schema name. +const ComputeForwardingRuleSchemaName string = "google_compute_forwarding_rule" + // ComputeForwardingRuleConverter for regional forwarding rule. type ComputeForwardingRuleConverter struct { name string @@ -20,9 +23,11 @@ type ComputeForwardingRuleConverter struct { } // NewComputeForwardingRuleConverter returns an HCL converter for compute instance. -func NewComputeForwardingRuleConverter(name string, schema map[string]*tfschema.Schema) common.Converter { +func NewComputeForwardingRuleConverter(provider *tfschema.Provider) common.Converter { + schema := provider.ResourcesMap[ComputeForwardingRuleSchemaName].Schema + return &ComputeForwardingRuleConverter{ - name: name, + name: ComputeForwardingRuleSchemaName, schema: schema, } } diff --git a/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule_test.go b/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule_test.go index 21a237724f6b..15d5d1cb701f 100644 --- a/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule_test.go +++ b/mmv1/third_party/cai2hcl/services/compute/compute_forwarding_rule_test.go @@ -1,17 +1,14 @@ -package compute +package compute_test import ( "testing" - cai2hclTesting "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/testing" + cai2hcl_testing "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/testing" ) func TestComputeForwardingRule(t *testing.T) { - cai2hclTesting.AssertTestFiles( + cai2hcl_testing.AssertTestFiles( t, - ConverterNames, ConverterMap, "./testdata", - []string{ - "full_compute_forwarding_rule", - }) + []string{"compute_forwarding_rule"}) } diff --git a/mmv1/third_party/cai2hcl/services/compute/compute_instance.go b/mmv1/third_party/cai2hcl/services/compute/compute_instance.go index 8453eb892327..56fa3ef3ed02 100644 --- a/mmv1/third_party/cai2hcl/services/compute/compute_instance.go +++ b/mmv1/third_party/cai2hcl/services/compute/compute_instance.go @@ -7,7 +7,7 @@ import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/caiasset" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" - tfschema "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/zclconf/go-cty/cty" "google.golang.org/api/compute/v1" ) @@ -15,16 +15,21 @@ import ( // ComputeInstanceAssetType is the CAI asset type name for compute instance. const ComputeInstanceAssetType string = "compute.googleapis.com/Instance" +// ComputeInstanceSchemaName is the TF resource schema name for compute instance. +const ComputeInstanceSchemaName string = "google_compute_instance" + // ComputeInstanceConverter for compute instance resource. type ComputeInstanceConverter struct { name string - schema map[string]*tfschema.Schema + schema map[string]*schema.Schema } // NewComputeInstanceConverter returns an HCL converter for compute instance. -func NewComputeInstanceConverter(name string, schema map[string]*tfschema.Schema) common.Converter { +func NewComputeInstanceConverter(provider *schema.Provider) common.Converter { + schema := provider.ResourcesMap[ComputeInstanceSchemaName].Schema + return &ComputeInstanceConverter{ - name: name, + name: ComputeInstanceSchemaName, schema: schema, } } diff --git a/mmv1/third_party/cai2hcl/services/compute/compute_instance_test.go b/mmv1/third_party/cai2hcl/services/compute/compute_instance_test.go index 0b7eaf876d39..8c73f93e1ee8 100644 --- a/mmv1/third_party/cai2hcl/services/compute/compute_instance_test.go +++ b/mmv1/third_party/cai2hcl/services/compute/compute_instance_test.go @@ -1,4 +1,4 @@ -package compute +package compute_test import ( "testing" @@ -9,7 +9,6 @@ import ( func TestComputeInstance(t *testing.T) { cai2hclTesting.AssertTestFiles( t, - ConverterNames, ConverterMap, "./testdata", []string{ "full_compute_instance", diff --git a/mmv1/third_party/cai2hcl/services/compute/converter_map.go b/mmv1/third_party/cai2hcl/services/compute/converter_map.go deleted file mode 100644 index 48c782727116..000000000000 --- a/mmv1/third_party/cai2hcl/services/compute/converter_map.go +++ /dev/null @@ -1,15 +0,0 @@ -package compute - -import ( - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" -) - -var ConverterNames = map[string]string{ - ComputeInstanceAssetType: "google_compute_instance", - ComputeForwardingRuleAssetType: "google_compute_forwarding_rule", -} - -var ConverterMap = common.CreateConverterMap(map[string]common.ConverterFactory{ - "google_compute_instance": NewComputeInstanceConverter, - "google_compute_forwarding_rule": NewComputeForwardingRuleConverter, -}) diff --git a/mmv1/third_party/cai2hcl/services/compute/testdata/full_compute_forwarding_rule.json b/mmv1/third_party/cai2hcl/services/compute/testdata/compute_forwarding_rule.json similarity index 98% rename from mmv1/third_party/cai2hcl/services/compute/testdata/full_compute_forwarding_rule.json rename to mmv1/third_party/cai2hcl/services/compute/testdata/compute_forwarding_rule.json index d86ad6f2d421..bbb085754a27 100644 --- a/mmv1/third_party/cai2hcl/services/compute/testdata/full_compute_forwarding_rule.json +++ b/mmv1/third_party/cai2hcl/services/compute/testdata/compute_forwarding_rule.json @@ -25,7 +25,7 @@ } }, { - "name": "//compute.googleapis.com/projects/myproj/regions/us-central1/instances/test-2", + "name": "//compute.googleapis.com/projects/myproj/regions/us-central1/forwardingRules/test-2", "asset_type": "compute.googleapis.com/ForwardingRule", "ancestry_path": "organizations/123/folders/456/project/myproj", "resource": { diff --git a/mmv1/third_party/cai2hcl/services/compute/testdata/full_compute_forwarding_rule.tf b/mmv1/third_party/cai2hcl/services/compute/testdata/compute_forwarding_rule.tf similarity index 100% rename from mmv1/third_party/cai2hcl/services/compute/testdata/full_compute_forwarding_rule.tf rename to mmv1/third_party/cai2hcl/services/compute/testdata/compute_forwarding_rule.tf diff --git a/mmv1/third_party/cai2hcl/services/resourcemanager/converter_map.go b/mmv1/third_party/cai2hcl/services/resourcemanager/converter_map.go deleted file mode 100644 index e999a92ec0f5..000000000000 --- a/mmv1/third_party/cai2hcl/services/resourcemanager/converter_map.go +++ /dev/null @@ -1,14 +0,0 @@ -package resourcemanager - -import ( - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" -) - -var ConverterNames = map[string]string{ - ProjectAssetType: "google_project", - ProjectBillingAssetType: "google_project", -} - -var ConverterMap = common.CreateConverterMap(map[string]common.ConverterFactory{ - "google_project": NewProjectConverter, -}) diff --git a/mmv1/third_party/cai2hcl/services/resourcemanager/project.go b/mmv1/third_party/cai2hcl/services/resourcemanager/project.go index e0fe0a2296fe..9f16e6766028 100644 --- a/mmv1/third_party/cai2hcl/services/resourcemanager/project.go +++ b/mmv1/third_party/cai2hcl/services/resourcemanager/project.go @@ -19,6 +19,9 @@ const ProjectAssetType string = "cloudresourcemanager.googleapis.com/Project" // ProjectAssetType is the CAI asset type name for project. const ProjectBillingAssetType string = "cloudbilling.googleapis.com/ProjectBillingInfo" +// ProjectSchemaName is the TF resource schema name for resourcemanager project. +const ProjectSchemaName string = "google_project" + // ProjectConverter for compute project resource. type ProjectConverter struct { name string @@ -27,9 +30,11 @@ type ProjectConverter struct { } // NewProjectConverter returns an HCL converter for compute project. -func NewProjectConverter(name string, schema map[string]*tfschema.Schema) common.Converter { +func NewProjectConverter(provider *tfschema.Provider) common.Converter { + schema := provider.ResourcesMap[ProjectSchemaName].Schema + return &ProjectConverter{ - name: name, + name: ProjectSchemaName, schema: schema, billings: make(map[string]string), } diff --git a/mmv1/third_party/cai2hcl/services/resourcemanager/project_test.go b/mmv1/third_party/cai2hcl/services/resourcemanager/project_test.go index 9d6d0bb11a07..645c2edc6f3c 100644 --- a/mmv1/third_party/cai2hcl/services/resourcemanager/project_test.go +++ b/mmv1/third_party/cai2hcl/services/resourcemanager/project_test.go @@ -1,4 +1,4 @@ -package resourcemanager +package resourcemanager_test import ( "testing" @@ -9,7 +9,6 @@ import ( func TestComputeInstance(t *testing.T) { cai2hclTesting.AssertTestFiles( t, - ConverterNames, ConverterMap, "./testdata", []string{ "project_create", diff --git a/mmv1/third_party/cai2hcl/testing/assert_test_files.go b/mmv1/third_party/cai2hcl/testing/assert_test_files.go index e020e4f0d59d..b05085ded43d 100644 --- a/mmv1/third_party/cai2hcl/testing/assert_test_files.go +++ b/mmv1/third_party/cai2hcl/testing/assert_test_files.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl/common" + "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/cai2hcl" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/caiasset" "go.uber.org/zap" @@ -18,7 +18,7 @@ type _TestCase struct { sourceFolder string } -func AssertTestFiles(t *testing.T, converterNames map[string]string, converterMap map[string]common.Converter, folder string, fileNames []string) { +func AssertTestFiles(t *testing.T, folder string, fileNames []string) { cases := []_TestCase{} for _, name := range fileNames { @@ -31,7 +31,7 @@ func AssertTestFiles(t *testing.T, converterNames map[string]string, converterMa t.Run(c.name, func(t *testing.T) { t.Parallel() - err := assertTestData(c, converterNames, converterMap) + err := assertTestData(c) if err != nil { t.Fatal(err) } @@ -39,7 +39,7 @@ func AssertTestFiles(t *testing.T, converterNames map[string]string, converterMa } } -func assertTestData(testCase _TestCase, converterNames map[string]string, converterMap map[string]common.Converter) (err error) { +func assertTestData(testCase _TestCase) (err error) { fileName := testCase.name folder := testCase.sourceFolder @@ -64,7 +64,9 @@ func assertTestData(testCase _TestCase, converterNames map[string]string, conver return err } - got, err := common.Convert(assets, converterNames, converterMap) + got, err := cai2hcl.Convert(assets, &cai2hcl.Options{ + ErrorLogger: logger, + }) if err != nil { return err }