Skip to content

Commit ed081ae

Browse files
committed
example of test with errors
1 parent 9dc1b93 commit ed081ae

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

internal/convert/adv2new.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
package convert
22

3+
import "github.com/mongodb-labs/atlas-cli-plugin-terraform/internal/hcl"
4+
35
// AdvancedClusterToNew transforms all mongodbatlas_advanced_cluster resource definitions in a
46
// Terraform configuration file from SDKv2 schema to TPF (Terraform Plugin Framework) schema.
57
// All other resources and data sources are left untouched.
68
func AdvancedClusterToNew(config []byte) ([]byte, error) {
7-
return config, nil
9+
parser, err := hcl.GetParser(config)
10+
if err != nil {
11+
return nil, err
12+
}
13+
return parser.Bytes(), nil
814
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resource this is an invalid HCL configuration file
2+
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"configuration_file_error": "failed to parse Terraform config file"
3+
}

0 commit comments

Comments
 (0)