Skip to content

Commit c8fb1b6

Browse files
test arrays and blocks
1 parent cd8e947 commit c8fb1b6

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

internal/testprovider/schema_nested_fully_computed.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,27 @@ func resourceNestedFullyComputedSchema() map[string]*schema.Schema {
4848
Type: schema.TypeString,
4949
Optional: true,
5050
},
51+
"a3": {
52+
Type: schema.TypeString,
53+
Required: true,
54+
},
55+
},
56+
},
57+
},
58+
"other_block": {
59+
Type: schema.TypeList,
60+
Optional: true,
61+
MaxItems: 1,
62+
Elem: &schema.Resource{
63+
Schema: map[string]*schema.Schema{
64+
"b1": {
65+
Type: schema.TypeString,
66+
Computed: true,
67+
},
68+
"b2": {
69+
Type: schema.TypeString,
70+
Required: true,
71+
},
5172
},
5273
},
5374
},

pkg/tfgen/test_data/nested-fully-computed-schema.json

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,42 @@
3232
},
3333
"a2": {
3434
"type": "string"
35+
},
36+
"a3": {
37+
"type": "string"
38+
}
39+
},
40+
"type": "object",
41+
"required": [
42+
"a3"
43+
],
44+
"language": {
45+
"nodejs": {
46+
"requiredOutputs": [
47+
"a1",
48+
"a3"
49+
]
50+
}
51+
}
52+
},
53+
"testprovider:index/ResOtherBlock:ResOtherBlock": {
54+
"properties": {
55+
"b1": {
56+
"type": "string"
57+
},
58+
"b2": {
59+
"type": "string"
3560
}
3661
},
3762
"type": "object",
63+
"required": [
64+
"b2"
65+
],
3866
"language": {
3967
"nodejs": {
4068
"requiredOutputs": [
41-
"a1"
69+
"b1",
70+
"b2"
4271
]
4372
}
4473
}
@@ -58,6 +87,9 @@
5887
"items": {
5988
"$ref": "#/types/testprovider:index/ResBlock:ResBlock"
6089
}
90+
},
91+
"otherBlock": {
92+
"$ref": "#/types/testprovider:index/ResOtherBlock:ResOtherBlock"
6193
}
6294
},
6395
"required": [
@@ -69,6 +101,9 @@
69101
"items": {
70102
"$ref": "#/types/testprovider:index/ResBlock:ResBlock"
71103
}
104+
},
105+
"otherBlock": {
106+
"$ref": "#/types/testprovider:index/ResOtherBlock:ResOtherBlock"
72107
}
73108
},
74109
"requiredInputs": [
@@ -82,6 +117,9 @@
82117
"items": {
83118
"$ref": "#/types/testprovider:index/ResBlock:ResBlock"
84119
}
120+
},
121+
"otherBlock": {
122+
"$ref": "#/types/testprovider:index/ResOtherBlock:ResOtherBlock"
85123
}
86124
},
87125
"type": "object"

0 commit comments

Comments
 (0)