Skip to content

Commit 9f613c8

Browse files
Sagar Daswanisagarp337
authored andcommitted
Added - Support for OCI Cache Discovery Endpoint for Sharded Clusters
1 parent e154029 commit 9f613c8

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

internal/integrationtest/redis_redis_cluster_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func TestRedisRedisClusterResource_basic(t *testing.T) {
248248
resource.TestCheckResourceAttr(shardedResourceName, "cluster_mode", "SHARDED"),
249249
resource.TestCheckResourceAttr(shardedResourceName, "compartment_id", compartmentId),
250250
resource.TestCheckResourceAttr(shardedResourceName, "display_name", "displayNameSharded"),
251+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_endpoint_ip_address"),
252+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_fqdn"),
251253
resource.TestCheckResourceAttr(shardedResourceName, "freeform_tags.%", "1"),
252254
resource.TestCheckResourceAttrSet(shardedResourceName, "id"),
253255
resource.TestCheckResourceAttr(shardedResourceName, "node_collection.0.items.#", "0"),
@@ -281,6 +283,8 @@ func TestRedisRedisClusterResource_basic(t *testing.T) {
281283
resource.TestCheckResourceAttr(shardedResourceName, "cluster_mode", "SHARDED"),
282284
resource.TestCheckResourceAttr(shardedResourceName, "compartment_id", compartmentIdU),
283285
resource.TestCheckResourceAttr(shardedResourceName, "display_name", "displayNameSharded"),
286+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_endpoint_ip_address"),
287+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_fqdn"),
284288
resource.TestCheckResourceAttr(shardedResourceName, "freeform_tags.%", "1"),
285289
resource.TestCheckResourceAttrSet(shardedResourceName, "id"),
286290
resource.TestCheckResourceAttr(shardedResourceName, "node_collection.0.items.#", "0"),
@@ -308,6 +312,8 @@ func TestRedisRedisClusterResource_basic(t *testing.T) {
308312
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
309313
resource.TestCheckResourceAttr(shardedResourceName, "cluster_mode", "SHARDED"),
310314
resource.TestCheckResourceAttr(shardedResourceName, "compartment_id", compartmentId),
315+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_endpoint_ip_address"),
316+
resource.TestCheckResourceAttrSet(shardedResourceName, "discovery_fqdn"),
311317
resource.TestCheckResourceAttr(shardedResourceName, "display_name", "displayNameSharded2"),
312318
resource.TestCheckResourceAttr(shardedResourceName, "freeform_tags.%", "1"),
313319
resource.TestCheckResourceAttrSet(shardedResourceName, "id"),

internal/service/redis/redis_redis_cluster_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ func (s *RedisRedisClusterDataSourceCrud) SetData() error {
7676
s.D.Set("defined_tags", tfresource.DefinedTagsToMap(s.Res.DefinedTags))
7777
}
7878

79+
if s.Res.DiscoveryEndpointIpAddress != nil {
80+
s.D.Set("discovery_endpoint_ip_address", *s.Res.DiscoveryEndpointIpAddress)
81+
}
82+
83+
if s.Res.DiscoveryFqdn != nil {
84+
s.D.Set("discovery_fqdn", *s.Res.DiscoveryFqdn)
85+
}
86+
7987
if s.Res.DisplayName != nil {
8088
s.D.Set("display_name", *s.Res.DisplayName)
8189
}

internal/service/redis/redis_redis_cluster_resource.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ func RedisRedisClusterResource() *schema.Resource {
9999
},
100100

101101
// Computed
102+
"discovery_endpoint_ip_address": {
103+
Type: schema.TypeString,
104+
Computed: true,
105+
},
106+
"discovery_fqdn": {
107+
Type: schema.TypeString,
108+
Computed: true,
109+
},
102110
"lifecycle_details": {
103111
Type: schema.TypeString,
104112
Computed: true,
@@ -644,6 +652,14 @@ func (s *RedisRedisClusterResourceCrud) SetData() error {
644652
s.D.Set("defined_tags", tfresource.DefinedTagsToMap(s.Res.DefinedTags))
645653
}
646654

655+
if s.Res.DiscoveryEndpointIpAddress != nil {
656+
s.D.Set("discovery_endpoint_ip_address", *s.Res.DiscoveryEndpointIpAddress)
657+
}
658+
659+
if s.Res.DiscoveryFqdn != nil {
660+
s.D.Set("discovery_fqdn", *s.Res.DiscoveryFqdn)
661+
}
662+
647663
if s.Res.DisplayName != nil {
648664
s.D.Set("display_name", *s.Res.DisplayName)
649665
}
@@ -764,6 +780,14 @@ func RedisClusterSummaryToMap(obj oci_redis.RedisClusterSummary, datasource bool
764780
result["defined_tags"] = tfresource.DefinedTagsToMap(obj.DefinedTags)
765781
}
766782

783+
if obj.DiscoveryEndpointIpAddress != nil {
784+
result["discovery_endpoint_ip_address"] = string(*obj.DiscoveryEndpointIpAddress)
785+
}
786+
787+
if obj.DiscoveryFqdn != nil {
788+
result["discovery_fqdn"] = string(*obj.DiscoveryFqdn)
789+
}
790+
767791
if obj.DisplayName != nil {
768792
result["display_name"] = string(*obj.DisplayName)
769793
}

website/docs/d/redis_redis_cluster.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ The following attributes are exported:
3535
* `cluster_mode` - Specifies whether the cluster is sharded or non-sharded.
3636
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the compartment that contains the cluster.
3737
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
38+
* `discovery_endpoint_ip_address` - The private IP address of the API endpoint for sharded cluster discovery.
39+
* `discovery_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for sharded cluster discovery.
3840
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
3941
* `freeform_tags` - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
4042
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the cluster.

website/docs/d/redis_redis_clusters.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ The following attributes are exported:
4949
* `cluster_mode` - Specifies whether the cluster is sharded or non-sharded.
5050
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the compartment that contains the cluster.
5151
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
52+
* `discovery_endpoint_ip_address` - The private IP address of the API endpoint for sharded cluster discovery.
53+
* `discovery_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for sharded cluster discovery.
5254
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
5355
* `freeform_tags` - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
5456
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the cluster.

website/docs/r/redis_redis_cluster.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ The following attributes are exported:
6363
* `cluster_mode` - Specifies whether the cluster is sharded or non-sharded.
6464
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the compartment that contains the cluster.
6565
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace.bar-key": "value"}`
66+
* `discovery_endpoint_ip_address` - The private IP address of the API endpoint for sharded cluster discovery.
67+
* `discovery_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for sharded cluster discovery.
6668
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
6769
* `freeform_tags` - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
6870
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the cluster.

0 commit comments

Comments
 (0)