Skip to content

Commit

Permalink
Test nested fields translate correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Frassle committed Dec 14, 2022
1 parent 0c11faa commit 37f5d2b
Show file tree
Hide file tree
Showing 8 changed files with 405 additions and 2 deletions.
17 changes: 17 additions & 0 deletions pkg/tf2pulumi/convert/testdata/complex_datasource/main.tf
@@ -0,0 +1,17 @@
data "complex_data_source" "a_data_source" {
a_bool = true
a_number = 2.3
a_string = "hello world"
a_list_of_int = [1, 2, 3]
a_map_of_bool = {
a: true
b: false
}
inner_object {
inner_string = "hello again"
}
}

output "some_output" {
value = data.complex_data_source.a_data_source.result
}
16 changes: 16 additions & 0 deletions pkg/tf2pulumi/convert/testdata/complex_datasource/pcl/main.pp
@@ -0,0 +1,16 @@
aDataSource = invoke("complex:index/index:data_source", {
aBool = true,
aNumber = 2.3,
aString = "hello world",
aListOfInts = [1, 2, 3],
aMapOfBool = {
a: true
b: false
},
innerObject = {
innerString = "hello again"
}
})
output someOutput {
value = aDataSource.result
}
17 changes: 17 additions & 0 deletions pkg/tf2pulumi/convert/testdata/complex_resource/main.tf
@@ -0,0 +1,17 @@
resource "complex_resource" "a_resource" {
a_bool = true
a_number = 2.3
a_string = "hello world"
a_list_of_int = [1, 2, 3]
a_map_of_bool = {
a: true
b: false
}
inner_object {
inner_string = "hello again"
}
}

output "some_output" {
value = data.complex_resource.a_resource.result
}
16 changes: 16 additions & 0 deletions pkg/tf2pulumi/convert/testdata/complex_resource/pcl/main.pp
@@ -0,0 +1,16 @@
resource aResource "complex:index/index:resource" {
aBool = true
aNumber = 2.3
aString = "hello world"
aListOfInts = [1, 2, 3]
aMapOfBool = {
a: true
b: false
}
innerObject = {
innerString = "hello again"
}
}
output someOutput {
value = aResource.result
}
117 changes: 117 additions & 0 deletions pkg/tf2pulumi/convert/testdata/mappings/complex.json
@@ -0,0 +1,117 @@
{
"name": "complex",
"provider": {
"dataSources": {
"complex_data_source": {
"a_bool": {
"type": 1,
"optional": true
},
"a_number": {
"type": 3,
"optional": true
},
"a_string": {
"type": 4,
"optional": true
},
"a_list_of_int": {
"type": 5,
"optional": true,
"element": {
"schema": {
"type": 2
}
}
},
"a_map_of_bool": {
"type": 6,
"optional": true,
"element": {
"schema": {
"type": 1
}
}
},
"inner_object": {
"type": 5,
"optional": true,
"maxItems": 1,
"element": {
"resource": {
"inner_string": {
"type": 4,
"optional": true
}
}
}
},
"result": {
"type": 4,
"computed": true
}
}
},
"resources": {
"complex_resource": {
"a_bool": {
"type": 1,
"optional": true
},
"a_number": {
"type": 3,
"optional": true
},
"a_string": {
"type": 4,
"optional": true
},
"a_list_of_int": {
"type": 5,
"optional": true,
"element": {
"schema": {
"type": 2
}
}
},
"a_map_of_bool": {
"type": 6,
"optional": true,
"element": {
"schema": {
"type": 1
}
}
},
"inner_object": {
"type": 5,
"optional": true,
"maxItems": 1,
"element": {
"resource": {
"inner_string": {
"type": 4,
"optional": true
}
}
}
},
"result": {
"type": 4,
"computed": true
}
}
}
},
"dataSources": {
"complex_data_source": {
"tok": "complex:index/index:data_source"
}
},
"resources": {
"complex_resource": {
"tok": "complex:index/index:resource"
}
}
}
1 change: 0 additions & 1 deletion pkg/tf2pulumi/convert/testdata/mappings/simple.json
Expand Up @@ -32,7 +32,6 @@
"computed": true
}
}

}
},
"dataSources": {
Expand Down

0 comments on commit 37f5d2b

Please sign in to comment.