-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: PoC - Schema code generation - Supporting nested attributes (#…
…2689) * support nested attribute types * rebasing changes related to unit testing adjustment
- Loading branch information
1 parent
14e3671
commit 8ddd508
Showing
8 changed files
with
139 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package test_name | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/resource/schema" | ||
) | ||
|
||
func ResourceSchema(ctx context.Context) schema.Schema { | ||
return schema.Schema{ | ||
Attributes: map[string]schema.Attribute{ | ||
"nested_single_attr": schema.SingleNestedAttribute{ | ||
Required: true, | ||
MarkdownDescription: "nested single attribute", | ||
Attributes: map[string]schema.Attribute{ | ||
"string_attr": schema.StringAttribute{ | ||
Optional: true, | ||
MarkdownDescription: "string attribute", | ||
}, | ||
}, | ||
}, | ||
"nested_list_attr": schema.ListNestedAttribute{ | ||
Optional: true, | ||
MarkdownDescription: "nested list attribute", | ||
Attributes: map[string]schema.Attribute{ | ||
"string_attr": schema.StringAttribute{ | ||
Optional: true, | ||
MarkdownDescription: "string attribute", | ||
}, | ||
}, | ||
}, | ||
"set_nested_attribute": schema.SetNestedAttribute{ | ||
Computed: true, | ||
Optional: true, | ||
MarkdownDescription: "set nested attribute", | ||
Attributes: map[string]schema.Attribute{ | ||
"string_attr": schema.StringAttribute{ | ||
Optional: true, | ||
MarkdownDescription: "string attribute", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |