Skip to content

Commit 2227023

Browse files
obai-1hkantare
authored andcommitted
Use DiffSuppressFunc
1 parent c6b93b5 commit 2227023

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ibm/service/database/resource_ibm_database.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,13 @@ func ResourceIBMDatabaseInstance() *schema.Resource {
251251
Description: "Types of the service endpoints. Possible values are 'public', 'private', 'public-and-private'.",
252252
Type: schema.TypeString,
253253
Optional: true,
254-
Default: "public",
255254
ValidateFunc: validate.InvokeValidator("ibm_database", "service_endpoints"),
255+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
256+
if new == "" {
257+
return true
258+
}
259+
return false
260+
},
256261
},
257262
"backup_id": {
258263
Description: "The CRN of backup source database",
@@ -957,7 +962,7 @@ func ResourceIBMICDValidator() *validate.ResourceValidator {
957962
ValidateFunctionIdentifier: validate.ValidateAllowedStringValue,
958963
Type: validate.TypeString,
959964
AllowedValues: "public, private, public-and-private",
960-
Required: true})
965+
Required: false})
961966
validateSchema = append(validateSchema,
962967
validate.ValidateSchema{
963968
Identifier: "group_id",

website/docs/r/database.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ Review the argument reference that you can specify for your resource.
732732
- `remote_leader_id` - (Optional, String) A CRN of the leader database to make the replica(read-only) deployment. The leader database is created by a database deployment with the same service ID. A read-only replica is set up to replicate all of your data from the leader deployment to the replica deployment by using asynchronous replication. For more information, see [Configuring Read-only Replicas](https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-read-only-replicas).
733733
- `resource_group_id` - (Optional, Forces new resource, String) The ID of the resource group where you want to create the instance. To retrieve this value, run `ibmcloud resource groups` or use the `ibm_resource_group` data source. If no value is provided, the `default` resource group is used.
734734
- `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`, `databases-for-cassandra` and `databases-for-enterprisedb`.
735-
- `service_endpoints` - (Optional, String) Specify whether you want to enable the public, private, or both service endpoints. Supported values are `public`, `private`, or `public-and-private`. The default is `public`.
735+
- `service_endpoints` - (Optional, String) Specify whether you want to enable the public, private, or both service endpoints. Supported values are `public`, `private`, or `public-and-private`. If you leave `service_endpoints` empty, the default value will be set based on the compliance standard in the region where the instance is being created. Generally, if the region is enabled with FS Cloud/ENS High compliance, then the default would be `private`. Otherwise, the default would be `public`. During any update, if you leave `service_endpoints` empty, it will maintain the previously selected value.
736736
- `tags` (Optional, Array of Strings) A list of tags that you want to add to your instance.
737737
- `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.
738738
- `users` - (Optional, List of Objects) A list of users that you want to create on the database. Multiple blocks are allowed.

0 commit comments

Comments
 (0)