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

Add test for lists as blocks #692

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/list_as_blocks/main.tf
@@ -0,0 +1,17 @@
data "blocks_data_source" "a_data_source" {
a_list_of_resources {
inner_string = "hi"
}
a_list_of_resources {
inner_string = "bye"
}
}

resource "blocks_resource" "a_resource" {
a_list_of_resources {
inner_string = "hi"
}
a_list_of_resources {
inner_string = "bye"
}
}
18 changes: 18 additions & 0 deletions pkg/tf2pulumi/convert/testdata/list_as_blocks/pcl/main.pp
@@ -0,0 +1,18 @@
aDataSource = invoke("blocks:index/index:data_source", {
aListOfResources = [
{
innerString = "hi"
},
{
innerString = "bye"
} ]
})
resource aResource "blocks:index/index:resource" {
aListOfResources = [
{
innerString = "hi"
},
{
innerString = "bye"
} ]
}
55 changes: 55 additions & 0 deletions pkg/tf2pulumi/convert/testdata/mappings/blocks.json
@@ -0,0 +1,55 @@
{
"name": "blocks",
"provider": {
"dataSources": {
"blocks_data_source": {
"a_list_of_resources": {
"type": 5,
"optional": true,
"element": {
"resource": {
"inner_string": {
"type": 4,
"optional": true
}
}
}
},
"result": {
"type": 4,
"computed": true
}
}
},
"resources": {
"blocks_resource": {
"a_list_of_resources": {
"type": 5,
"optional": true,
"element": {
"resource": {
"inner_string": {
"type": 4,
"optional": true
}
}
}
},
"result": {
"type": 4,
"computed": true
}
}
}
},
"dataSources": {
"blocks_data_source": {
"tok": "blocks:index/index:data_source"
}
},
"resources": {
"blocks_resource": {
"tok": "blocks:index/index:resource"
}
}
}
130 changes: 130 additions & 0 deletions pkg/tf2pulumi/convert/testdata/schemas/blocks.json
@@ -0,0 +1,130 @@
{
"name": "blocks",
"attribution": "This Pulumi package is based on the [`blocks` Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks).",
"meta": {
"moduleFormat": "(.*)(?:/[^/]*)"
},
"language": {
"nodejs": {
"compatibility": "tfbridge20",
"disableUnionOutputTypes": true,
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues)."
},
"python": {
"compatibility": "tfbridge20",
"readme": "\u003e This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-blocks)\n\u003e distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-blocks` repo](/issues); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-blocks` repo](https://github.com/terraform-providers/terraform-provider-blocks/issues)."
}
},
"config": {},
"types": {
"blocks:index/data_sourceAListOfResource:data_sourceAListOfResource": {
"properties": {
"innerString": {
"type": "string",
"language": {
"python": {
"mapCase": false
}
}
}
},
"type": "object"
},
"blocks:index/resourceAListOfResource:resourceAListOfResource": {
"properties": {
"innerString": {
"type": "string",
"language": {
"python": {
"mapCase": false
}
}
}
},
"type": "object"
}
},
"provider": {
"description": "The provider type for the blocks package. By default, resources use package-wide configuration\nsettings, however an explicit `Provider` instance may be created and passed during resource\nconstruction to achieve fine-grained programmatic control over provider settings. See the\n[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.\n"
},
"resources": {
"blocks:index/index:resource": {
"properties": {
"aListOfResources": {
"type": "array",
"items": {
"$ref": "#/types/blocks:index/resourceAListOfResource:resourceAListOfResource"
}
},
"result": {
"type": "string"
}
},
"required": [
"result"
],
"inputProperties": {
"aListOfResources": {
"type": "array",
"items": {
"$ref": "#/types/blocks:index/resourceAListOfResource:resourceAListOfResource"
}
}
},
"stateInputs": {
"description": "Input properties used for looking up and filtering resource resources.\n",
"properties": {
"aListOfResources": {
"type": "array",
"items": {
"$ref": "#/types/blocks:index/resourceAListOfResource:resourceAListOfResource"
}
},
"result": {
"type": "string"
}
},
"type": "object"
}
}
},
"functions": {
"blocks:index/index:data_source": {
"inputs": {
"description": "A collection of arguments for invoking data_source.\n",
"properties": {
"aListOfResources": {
"type": "array",
"items": {
"$ref": "#/types/blocks:index/data_sourceAListOfResource:data_sourceAListOfResource"
}
}
},
"type": "object"
},
"outputs": {
"description": "A collection of values returned by data_source.\n",
"properties": {
"aListOfResources": {
"type": "array",
"items": {
"$ref": "#/types/blocks:index/data_sourceAListOfResource:data_sourceAListOfResource"
}
},
"id": {
"type": "string",
"description": "The provider-assigned unique ID for this managed resource.\n"
},
"result": {
"type": "string"
}
},
"type": "object",
"required": [
"result",
"id"
]
}
}
}
}