From 575c4ed22881e9b906346b17fe95c3b358a1c883 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 24 Jun 2023 14:39:13 +0200 Subject: Update projects data source schema to use an extended attributes definition --- CHANGELOG.md | 5 +++++ docs/data-sources/projects.md | 10 +++++----- internal/provider/projects_data_source.go | 23 ++++++++++++++--------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae659e1..c777260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.0.3 - 2023-06-24 + +### Notes +* Update projects data source schema to use an extended attributes definition + ## 0.0.2 - 2023-06-19 ### Notes diff --git a/docs/data-sources/projects.md b/docs/data-sources/projects.md index 7642834..306a718 100644 --- a/docs/data-sources/projects.md +++ b/docs/data-sources/projects.md @@ -3,12 +3,12 @@ page_title: "eventline_projects Data Source - terraform-provider-eventline" subcategory: "" description: |- - Eventline projects data source + Use this data source to retrieve information about existing eventline projects. --- # eventline_projects (Data Source) -Eventline projects data source +Use this data source to retrieve information about existing eventline projects. ## Example Usage @@ -22,12 +22,12 @@ data "projects" "example" { ### Read-Only -- `elements` (List of Object) Projects list (see [below for nested schema](#nestedatt--elements)) +- `elements` (Attributes List) The list of projects. (see [below for nested schema](#nestedatt--elements)) ### Nested Schema for `elements` Read-Only: -- `id` (String) -- `name` (String) +- `id` (String) The identifier of the project. +- `name` (String) The name of the project. diff --git a/internal/provider/projects_data_source.go b/internal/provider/projects_data_source.go index 4559b46..6f44a93 100644 --- a/internal/provider/projects_data_source.go +++ b/internal/provider/projects_data_source.go @@ -5,7 +5,6 @@ import ( "fmt" "git.adyxax.org/adyxax/terraform-provider-eventline/external/evcli" - "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -35,18 +34,24 @@ func (d *ProjectsDataSource) Metadata(ctx context.Context, req datasource.Metada func (d *ProjectsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "elements": schema.ListAttribute{ - Computed: true, - ElementType: types.ObjectType{ - AttrTypes: map[string]attr.Type{ - "id": types.StringType, - "name": types.StringType, + "elements": schema.ListNestedAttribute{ + Computed: true, + MarkdownDescription: "The list of projects.", + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The identifier of the project.", + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The name of the project.", + }, }, }, - MarkdownDescription: "Projects list", }, }, - MarkdownDescription: "Eventline projects data source", + MarkdownDescription: "Use this data source to retrieve information about existing eventline projects.", } } -- cgit v1.2.3