From 8d3fab405cc49490c46d0c6892c3def92f4f658b Mon Sep 17 00:00:00 2001 From: lornakelly Date: Mon, 9 Dec 2024 18:01:05 +0000 Subject: [PATCH] Revert "Add version validation (#5791)" (#5859) This reverts commit f5425502e500d119ca517d45c268df36c86549b9. Co-authored-by: Lorna-Kelly --- ibm/service/database/resource_ibm_database.go | 21 +++++-------------- website/docs/r/database.html.markdown | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index 150b5b3ce2..4150816d1b 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -141,7 +141,6 @@ func ResourceIBMDatabaseInstance() *schema.Resource { resourceIBMDatabaseInstanceDiff, validateGroupsDiff, validateUsersDiff, - validateVersionDiff, validateRemoteLeaderIDDiff), Importer: &schema.ResourceImporter{}, @@ -242,11 +241,11 @@ func ResourceIBMDatabaseInstance() *schema.Resource { Description: "The configuration schema in JSON format", }, "version": { - Description: "The database version to provision if specified", - Type: schema.TypeString, - Optional: true, - Computed: true, - DiffSuppressFunc: flex.ApplyOnce, + Description: "The database version to provision if specified", + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, }, "service_endpoints": { Description: "Types of the service endpoints. Possible values are 'public', 'private', 'public-and-private'.", @@ -2965,16 +2964,6 @@ func getCpuEnforcementRatios(service string, plan string, hostFlavor string, met return nil, 0, 0 } -func validateVersionDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { - version, configVersion := diff.GetChange("version") - - if version != configVersion { - return fmt.Errorf("[ERROR] The version in your configuration file (%s) does not match the version of your remote instance (%s). Make sure that you have the same version in your configuration as the version on the remote instance. Learn more about the versioning policy here: https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-versioning-policy ", configVersion, version) - } - - return nil -} - func validateUsersDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) (err error) { service := diff.Get("service").(string) diff --git a/website/docs/r/database.html.markdown b/website/docs/r/database.html.markdown index cb0bddec4a..e8115eb27f 100644 --- a/website/docs/r/database.html.markdown +++ b/website/docs/r/database.html.markdown @@ -686,7 +686,7 @@ Review the argument reference that you can specify for your resource. - `service` - (Required, Forces new resource, String) The type of Cloud Databases that you want to create. Only the following services are currently accepted: `databases-for-etcd`, `databases-for-postgresql`, `databases-for-redis`, `databases-for-elasticsearch`, `messages-for-rabbitmq`,`databases-for-mongodb`,`databases-for-mysql`, and `databases-for-enterprisedb`. - `service_endpoints` - (Required, String) Specify whether you want to enable the public, private, or both service endpoints. Supported values are `public`, `private`, or `public-and-private`. - `tags` (Optional, Array of Strings) A list of tags that you want to add to your instance. -- `version` - (Optional, String) The version of the database to be provisioned. If omitted, the database is created with the most recent major and minor version. For more information, see our [versioning policy](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-versioning-policy). +- `version` - (Optional, Forces new resource, String) The version of the database to be provisioned. If omitted, the database is created with the most recent major and minor version. - `deletion_protection` - (Optional, Boolean) If the DB instance should have deletion protection within terraform enabled. This is not a property of the resource and does not prevent deletion outside of terraform. The database can't be deleted by terraform when this value is set to `true`. The default is `false`. - `users` - (Optional, List of Objects) A list of users that you want to create on the database. Multiple blocks are allowed.