Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test nested fields translate correctly #687

Merged
merged 1 commit into from Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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