From fe777fd9bcb0d6f3e49ab31a90d172884ab9eaf4 Mon Sep 17 00:00:00 2001 From: Vicente Pinto Date: Wed, 4 Sep 2024 16:16:24 +0100 Subject: [PATCH] Remove leftover Postgresql code and documentation (#527) * Remove leftover postgresql code * Remove examples * revert go.mod * Revert loadbalancer doc --- .github/workflows/tf-acc-test.yaml | 1 - MIGRATION.md | 6 ++-- docs/index.md | 1 - docs/resources/loadbalancer.md | 28 +++++++++---------- .../data-source.tf | 5 ---- .../data-source.tf | 4 --- .../stackit_postgresql_credential/resource.tf | 4 --- .../stackit_postgresql_instance/resource.tf | 9 ------ stackit/internal/core/core.go | 1 - .../objectstorage/credential/datasource.go | 4 +-- .../postgresflex/postgresflex_acc_test.go | 2 +- stackit/internal/testutil/testutil.go | 16 ----------- stackit/provider.go | 9 ------ 13 files changed, 19 insertions(+), 71 deletions(-) delete mode 100644 examples/data-sources/stackit_postgresql_credential/data-source.tf delete mode 100644 examples/data-sources/stackit_postgresql_instance/data-source.tf delete mode 100644 examples/resources/stackit_postgresql_credential/resource.tf delete mode 100644 examples/resources/stackit_postgresql_instance/resource.tf diff --git a/.github/workflows/tf-acc-test.yaml b/.github/workflows/tf-acc-test.yaml index 70501a07..8bd0491c 100644 --- a/.github/workflows/tf-acc-test.yaml +++ b/.github/workflows/tf-acc-test.yaml @@ -25,7 +25,6 @@ jobs: TF_ACC_OBSERVABILITY_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_OBSERVABILITY_CUSTOM_ENDPOINT }} TF_ACC_OPENSEARCH_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_OPENSEARCH_CUSTOM_ENDPOINT }} TF_ACC_POSTGRESFLEX_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_POSTGRESFLEX_CUSTOM_ENDPOINT }} - TF_ACC_POSTGRESQL_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_POSTGRESQL_CUSTOM_ENDPOINT }} TF_ACC_RABBITMQ_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_RABBITMQ_CUSTOM_ENDPOINT }} TF_ACC_REDIS_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_REDIS_CUSTOM_ENDPOINT }} TF_ACC_RESOURCEMANAGER_CUSTOM_ENDPOINT: ${{ secrets.TF_ACC_RESOURCEMANAGER_CUSTOM_ENDPOINT }} diff --git a/MIGRATION.md b/MIGRATION.md index 22b14f09..7ce5d613 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -152,11 +152,11 @@ resource "stackit_logme_credential" "example-credential" { | stackit_observability_instance | stackit_observability_instance | :white_check_mark: | [project_id],[instance_id] | | | stackit_observability_job | stackit_observability_scrapeconfig | :white_check_mark: | [project_id],[instance_id],[name] | | | stackit_opensearch_credential | stackit_opensearch_credential | :white_check_mark: | [project_id],[credentials_group_id],[credential_id] | | -| stackit_opensearch_instance | stackit_opensearch_instance | :white_check_mark: | [project_id],[instance_id] | | -| stackit_postgres_credential | stackit_postgresql_credential | :white_check_mark: | [project_id],[credentials_group_id],[credential_id] | | +| stackit_opensearch_instance | stackit_opensearch_instance | :white_check_mark: | [project_id],[instance_id] | | | | stackit_postgres_flex_instance | stackit_postgresflex_instance | :white_check_mark: | [project_id],[instance_id] | | | stackit_postgres_flex_user | stackit_postgresflex_user | :warning: | [project_id],[instance_id],[user_id] | `password` field will be empty | -| stackit_postgres_instance | stackit_postgresql_instance | :white_check_mark: | [project_id],[instance_id] | | +| stackit_postgres_instance | | | | Resource deprecated | +| stackit_postgres_credential | | | | Resource deprecated | stackit_project | stackit_resourcemanager_project | :white_check_mark: | [container_id] | | | stackit_rabbitmq_credential | stackit_rabbitmq_credential | :white_check_mark: | [project_id],[credentials_group_id],[credential_id] | | | stackit_rabbitmq_instance | stackit_rabbitmq_instance | :white_check_mark: | [project_id],[instance_id] | | diff --git a/docs/index.md b/docs/index.md index 19ee5852..25d496a6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -165,7 +165,6 @@ Note: AWS specific checks must be skipped as they do not work on STACKIT. For de - `observability_custom_endpoint` (String) Custom endpoint for the Observability service - `opensearch_custom_endpoint` (String) Custom endpoint for the OpenSearch service - `postgresflex_custom_endpoint` (String) Custom endpoint for the PostgresFlex service -- `postgresql_custom_endpoint` (String) Custom endpoint for the PostgreSQL service - `private_key` (String) Private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key. - `private_key_path` (String) Path for the private RSA key used for authentication, relevant for the key flow. It takes precedence over the private key that is included in the service account key. - `rabbitmq_custom_endpoint` (String) Custom endpoint for the RabbitMQ service diff --git a/docs/resources/loadbalancer.md b/docs/resources/loadbalancer.md index ad84605c..e5e4bbfe 100644 --- a/docs/resources/loadbalancer.md +++ b/docs/resources/loadbalancer.md @@ -8,25 +8,23 @@ description: |- To automate the creation of load balancers, OpenStack can be used to setup the supporting infrastructure. To set up the OpenStack provider, you can create a token through the STACKIT Portal, in your project's Infrastructure API page. There, the OpenStack user domain name, username, and password are generated and can be obtained. The provider can then be configured as follows: - + ```terraform terraform { - required_providers { - (...) - openstack = { - source = "terraform-provider-openstack/openstack" - } - } + required_providers { + (...) + openstack = { + source = "terraform-provider-openstack/openstack" + } + } } - provider "openstack" { - user_domain_name = "{OpenStack user domain name}" - user_name = "{OpenStack username}" - password = "{OpenStack password}" - region = "RegionOne" - auth_url = "https://keystone.api.iaas.eu01.stackit.cloud/v3" + user_domain_name = "{OpenStack user domain name}" + user_name = "{OpenStack username}" + password = "{OpenStack password}" + region = "RegionOne" + auth_url = "https://keystone.api.iaas.eu01.stackit.cloud/v3" } - - + ``` Configuring the supporting infrastructure The example below uses OpenStack to create the network, router, a public IP address and a compute instance. --- diff --git a/examples/data-sources/stackit_postgresql_credential/data-source.tf b/examples/data-sources/stackit_postgresql_credential/data-source.tf deleted file mode 100644 index 36893859..00000000 --- a/examples/data-sources/stackit_postgresql_credential/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ -data "stackit_postgresql_credential" "example" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - credential_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -} diff --git a/examples/data-sources/stackit_postgresql_instance/data-source.tf b/examples/data-sources/stackit_postgresql_instance/data-source.tf deleted file mode 100644 index caa5c1a7..00000000 --- a/examples/data-sources/stackit_postgresql_instance/data-source.tf +++ /dev/null @@ -1,4 +0,0 @@ -data "stackit_postgresql_instance" "example" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -} diff --git a/examples/resources/stackit_postgresql_credential/resource.tf b/examples/resources/stackit_postgresql_credential/resource.tf deleted file mode 100644 index a4e29f91..00000000 --- a/examples/resources/stackit_postgresql_credential/resource.tf +++ /dev/null @@ -1,4 +0,0 @@ -resource "stackit_postgresql_credential" "example" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -} diff --git a/examples/resources/stackit_postgresql_instance/resource.tf b/examples/resources/stackit_postgresql_instance/resource.tf deleted file mode 100644 index 47b887bb..00000000 --- a/examples/resources/stackit_postgresql_instance/resource.tf +++ /dev/null @@ -1,9 +0,0 @@ -resource "stackit_postgresql_instance" "example" { - project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - name = "example-instance" - version = "10" - plan_name = "example-plan-name" - parameters = { - sgw_acl = "x.x.x.x/x,y.y.y.y/y" - } -} diff --git a/stackit/internal/core/core.go b/stackit/internal/core/core.go index d67aaab4..ecdd3361 100644 --- a/stackit/internal/core/core.go +++ b/stackit/internal/core/core.go @@ -29,7 +29,6 @@ type ProviderData struct { ObservabilityCustomEndpoint string OpenSearchCustomEndpoint string PostgresFlexCustomEndpoint string - PostgreSQLCustomEndpoint string RabbitMQCustomEndpoint string RedisCustomEndpoint string ResourceManagerCustomEndpoint string diff --git a/stackit/internal/services/objectstorage/credential/datasource.go b/stackit/internal/services/objectstorage/credential/datasource.go index a99b7d00..a715d75f 100644 --- a/stackit/internal/services/objectstorage/credential/datasource.go +++ b/stackit/internal/services/objectstorage/credential/datasource.go @@ -48,10 +48,10 @@ func (r *credentialDataSource) Configure(ctx context.Context, req datasource.Con var apiClient *objectstorage.APIClient var err error - if providerData.PostgreSQLCustomEndpoint != "" { + if providerData.ObjectStorageCustomEndpoint != "" { apiClient, err = objectstorage.NewAPIClient( config.WithCustomAuth(providerData.RoundTripper), - config.WithEndpoint(providerData.PostgreSQLCustomEndpoint), + config.WithEndpoint(providerData.ObjectStorageCustomEndpoint), ) } else { apiClient, err = objectstorage.NewAPIClient( diff --git a/stackit/internal/services/postgresflex/postgresflex_acc_test.go b/stackit/internal/services/postgresflex/postgresflex_acc_test.go index 4cc339b9..99ebccf1 100644 --- a/stackit/internal/services/postgresflex/postgresflex_acc_test.go +++ b/stackit/internal/services/postgresflex/postgresflex_acc_test.go @@ -330,7 +330,7 @@ func testAccCheckPostgresFlexDestroy(s *terraform.State) error { instancesToDestroy := []string{} for _, rs := range s.RootModule().Resources { - if rs.Type != "stackit_postgresql_instance" { + if rs.Type != "stackit_postgresqlflex_instance" { continue } // instance terraform ID: = "[project_id],[instance_id]" diff --git a/stackit/internal/testutil/testutil.go b/stackit/internal/testutil/testutil.go index ed04fc37..d4b36acb 100644 --- a/stackit/internal/testutil/testutil.go +++ b/stackit/internal/testutil/testutil.go @@ -54,7 +54,6 @@ var ( OpenSearchCustomEndpoint = os.Getenv("TF_ACC_OPENSEARCH_CUSTOM_ENDPOINT") ObservabilityCustomEndpoint = os.Getenv("TF_ACC_OBSERVABILITY_CUSTOM_ENDPOINT") ObjectStorageCustomEndpoint = os.Getenv("TF_ACC_OBJECTSTORAGE_CUSTOM_ENDPOINT") - PostgreSQLCustomEndpoint = os.Getenv("TF_ACC_POSTGRESQL_CUSTOM_ENDPOINT") PostgresFlexCustomEndpoint = os.Getenv("TF_ACC_POSTGRESFLEX_CUSTOM_ENDPOINT") RabbitMQCustomEndpoint = os.Getenv("TF_ACC_RABBITMQ_CUSTOM_ENDPOINT") RedisCustomEndpoint = os.Getenv("TF_ACC_REDIS_CUSTOM_ENDPOINT") @@ -221,21 +220,6 @@ func OpenSearchProviderConfig() string { ) } -func PostgreSQLProviderConfig() string { - if PostgreSQLCustomEndpoint == "" { - return ` - provider "stackit" { - region = "eu01" - }` - } - return fmt.Sprintf(` - provider "stackit" { - postgresql_custom_endpoint = "%s" - }`, - PostgreSQLCustomEndpoint, - ) -} - func PostgresFlexProviderConfig() string { if PostgresFlexCustomEndpoint == "" { return ` diff --git a/stackit/provider.go b/stackit/provider.go index 72d2616e..796417fe 100644 --- a/stackit/provider.go +++ b/stackit/provider.go @@ -93,7 +93,6 @@ type providerModel struct { ArgusCustomEndpoint types.String `tfsdk:"argus_custom_endpoint"` DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"` IaaSCustomEndpoint types.String `tfsdk:"iaas_custom_endpoint"` - PostgreSQLCustomEndpoint types.String `tfsdk:"postgresql_custom_endpoint"` PostgresFlexCustomEndpoint types.String `tfsdk:"postgresflex_custom_endpoint"` MongoDBFlexCustomEndpoint types.String `tfsdk:"mongodbflex_custom_endpoint"` LoadBalancerCustomEndpoint types.String `tfsdk:"loadbalancer_custom_endpoint"` @@ -138,7 +137,6 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro "objectstorage_custom_endpoint": "Custom endpoint for the Object Storage service", "observability_custom_endpoint": "Custom endpoint for the Observability service", "opensearch_custom_endpoint": "Custom endpoint for the OpenSearch service", - "postgresql_custom_endpoint": "Custom endpoint for the PostgreSQL service", "postgresflex_custom_endpoint": "Custom endpoint for the PostgresFlex service", "redis_custom_endpoint": "Custom endpoint for the Redis service", "server_backup_custom_endpoint": "Custom endpoint for the Server Backup service", @@ -198,10 +196,6 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro Optional: true, Description: descriptions["iaas_custom_endpoint"], }, - "postgresql_custom_endpoint": schema.StringAttribute{ - Optional: true, - Description: descriptions["postgresql_custom_endpoint"], - }, "postgresflex_custom_endpoint": schema.StringAttribute{ Optional: true, Description: descriptions["postgresflex_custom_endpoint"], @@ -329,9 +323,6 @@ func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest, if !(providerConfig.IaaSCustomEndpoint.IsUnknown() || providerConfig.IaaSCustomEndpoint.IsNull()) { providerData.IaaSCustomEndpoint = providerConfig.IaaSCustomEndpoint.ValueString() } - if !(providerConfig.PostgreSQLCustomEndpoint.IsUnknown() || providerConfig.PostgreSQLCustomEndpoint.IsNull()) { - providerData.PostgreSQLCustomEndpoint = providerConfig.PostgreSQLCustomEndpoint.ValueString() - } if !(providerConfig.PostgresFlexCustomEndpoint.IsUnknown() || providerConfig.PostgresFlexCustomEndpoint.IsNull()) { providerData.PostgresFlexCustomEndpoint = providerConfig.PostgresFlexCustomEndpoint.ValueString() }