Skip to content

Commit

Permalink
add ephemeral resource to the test
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Oct 2, 2024
1 parent c303f28 commit ef36316
Showing 1 changed file with 90 additions and 1 deletion.
91 changes: 90 additions & 1 deletion internal/command/jsonprovider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,65 @@ func TestMarshalProvider(t *testing.T) {
},
},
},
EphemeralResourceSchemas: map[string]*Schema{},
EphemeralResourceSchemas: map[string]*Schema{
"test_eph_instance": {
Block: &Block{
Attributes: map[string]*Attribute{
"id": {
AttributeType: json.RawMessage(`"string"`),
Optional: true,
Computed: true,
DescriptionKind: "plain",
},
"ami": {
AttributeType: json.RawMessage(`"string"`),
Optional: true,
DescriptionKind: "plain",
},
"volumes": {
AttributeNestedType: &NestedType{
NestingMode: "list",
Attributes: map[string]*Attribute{
"size": {
AttributeType: json.RawMessage(`"string"`),
Required: true,
DescriptionKind: "plain",
},
"mount_point": {
AttributeType: json.RawMessage(`"string"`),
Required: true,
DescriptionKind: "plain",
},
},
},
Optional: true,
DescriptionKind: "plain",
},
},
BlockTypes: map[string]*BlockType{
"network_interface": {
Block: &Block{
Attributes: map[string]*Attribute{
"device_index": {
AttributeType: json.RawMessage(`"string"`),
Optional: true,
DescriptionKind: "plain",
},
"description": {
AttributeType: json.RawMessage(`"string"`),
Optional: true,
DescriptionKind: "plain",
},
},
DescriptionKind: "plain",
},
NestingMode: "list",
},
},
DescriptionKind: "plain",
},
},
},
},
},
}
Expand Down Expand Up @@ -226,5 +284,36 @@ func testProvider() providers.ProviderSchema {
},
},
},
EphemeralResourceTypes: map[string]providers.Schema{
"test_eph_instance": {
Block: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"id": {Type: cty.String, Optional: true, Computed: true},
"ami": {Type: cty.String, Optional: true},
"volumes": {
Optional: true,
NestedType: &configschema.Object{
Nesting: configschema.NestingList,
Attributes: map[string]*configschema.Attribute{
"size": {Type: cty.String, Required: true},
"mount_point": {Type: cty.String, Required: true},
},
},
},
},
BlockTypes: map[string]*configschema.NestedBlock{
"network_interface": {
Nesting: configschema.NestingList,
Block: configschema.Block{
Attributes: map[string]*configschema.Attribute{
"device_index": {Type: cty.String, Optional: true},
"description": {Type: cty.String, Optional: true},
},
},
},
},
},
},
},
}
}

0 comments on commit ef36316

Please sign in to comment.