Skip to content

Commit

Permalink
tests + versions updates (#211)
Browse files Browse the repository at this point in the history
* update mariadb default version

* deprecate ElasticSearch

* remove ES data source test

* update deprecation message

* update data source schema

* Automated docs update

---------

Co-authored-by: Dean Oren <deangili.oren@mail.schwarz>
Co-authored-by: do87 <do87@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 1, 2023
1 parent 333836c commit 5a8eb54
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 187 deletions.
6 changes: 3 additions & 3 deletions .github/files/analyze-test-output/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func main() {
}

func getDataServiceName(testName string) string {
if strings.Contains(testName, "ElasticSearch") {
return "elasticsearch-dsa"
}
// if strings.Contains(testName, "ElasticSearch") {
// return "elasticsearch-dsa"
// }
if strings.Contains(testName, "LogMe") {
return "logme-dsa"
}
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/elasticsearch_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ page_title: "stackit_elasticsearch_instance Data Source - stackit"
subcategory: ""
description: |-
Data source for ElasticSearch instances
This resource is deprecated and will be removed in a future release.
Please use OpenSearch resource and data-source instead.
-> Environment supportTo set a custom API base URL, set STACKITELASTICSEARCHBASEURL environment variable
---

# stackit_elasticsearch_instance (Data Source)

Data source for ElasticSearch instances
This resource is deprecated and will be removed in a future release.
Please use `OpenSearch` resource and data-source instead.


<br />

Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/logme_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for LogMe instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_LOGME_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/mariadb_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for MariaDB instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_MARIADB_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/opensearch_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for Opensearch instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_REDIS_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/postgres_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for Postgres instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_POSTGRESQL_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/rabbitmq_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for RabbitMQ instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_RABBITMQ_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/redis_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Data source for Redis instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_REDIS_BASEURL</code> environment variable </small>
Expand Down
5 changes: 5 additions & 0 deletions docs/resources/elasticsearch_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ page_title: "stackit_elasticsearch_instance Resource - stackit"
subcategory: ""
description: |-
Manages ElasticSearch instances
This resource is deprecated and will be removed in a future release.
Please use the stackit_opensearch_instance resource instead.
-> Environment supportTo set a custom API base URL, set STACKITELASTICSEARCHBASEURL environment variable
---

# stackit_elasticsearch_instance (Resource)

Manages ElasticSearch instances
This resource is deprecated and will be removed in a future release.
Please use the `stackit_opensearch_instance` resource instead.


<br />

Expand Down
1 change: 1 addition & 0 deletions docs/resources/logme_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages LogMe instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_LOGME_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/mariadb_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages MariaDB instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_MARIADB_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/opensearch_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages Opensearch instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_REDIS_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/postgres_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages Postgres instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_POSTGRESQL_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/rabbitmq_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages RabbitMQ instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_RABBITMQ_BASEURL</code> environment variable </small>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/redis_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-

Manages Redis instances


<br />

-> __Environment support__<small>To set a custom API base URL, set <code>STACKIT_REDIS_BASEURL</code> environment variable </small>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAcc_DataSourceMariaDBInstanceJob(t *testing.T) {
name := "odjtest-" + acctest.RandStringFromCharSet(7, acctest.CharSetAlpha)
plan := "stackit-mariadb-single-small"
planID := "8fc9e236-6173-40dc-a79a-02aba46ba75a"
version := "10.4"
version := "10.6"

resource.ParallelTest(t, resource.TestCase{
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){
Expand Down
11 changes: 10 additions & 1 deletion stackit/internal/data-sources/data-services/instance/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +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: printDeprecation(d.service.Display()),
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "Specifies the resource ID",
Expand Down Expand Up @@ -88,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 ""
}

This file was deleted.

11 changes: 10 additions & 1 deletion stackit/internal/resources/data-services/instance/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ type Instance struct {
// Schema returns the terraform schema structure
func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: fmt.Sprintf("Manages %s instances\n%s",
MarkdownDescription: fmt.Sprintf("Manages %s instances\n%s\n%s",
r.service.Display(),
printDeprecation(r.service.Display()),
common.EnvironmentInfo(r.urls),
),
DeprecationMessage: printDeprecation(r.service.Display()),
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "Specifies the resource ID",
Expand Down Expand Up @@ -114,3 +116,10 @@ func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp
},
}
}

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

0 comments on commit 5a8eb54

Please sign in to comment.