Skip to content

Commit

Permalink
update data source schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Oren committed Dec 1, 2023
1 parent e278c17 commit 74940ec
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions stackit/internal/data-sources/data-services/instance/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@ type Instance struct {
// Schema returns the terraform schema structure
func (d *DataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: fmt.Sprintf("Data source for %s instances\n%s",
MarkdownDescription: fmt.Sprintf("Data source for %s instances\n%s\n%s",
d.service.Display(),
printDeprecation(d.service.Display()),
common.EnvironmentInfo(d.urls),
),
DeprecationMessage: func() string {
if d.service.Display() == "ElasticSearch" {
return "This resource is deprecated and will be removed in a future release. Please use OpenSearch instead."
}
return ""
}(),
DeprecationMessage: printDeprecation(d.service.Display()),
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "Specifies the resource ID",
Expand Down Expand Up @@ -94,3 +90,10 @@ func (d *DataSource) Schema(ctx context.Context, req datasource.SchemaRequest, r
},
}
}

func printDeprecation(svc string) string {
if svc == "ElasticSearch" {
return "This resource is deprecated and will be removed in a future release.\nPlease use `OpenSearch` resource and data-source instead.\n"
}
return ""
}

0 comments on commit 74940ec

Please sign in to comment.