Skip to content

Commit 6fbc89b

Browse files
Shagufta GurmukhdasSrividyaKamakshi
authored andcommitted
Added - Support for [OCI Cache] - ZPR Security Attributes
1 parent 7b64c1e commit 6fbc89b

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

internal/integrationtest/redis_redis_cluster_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ var (
5757
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
5858
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"bar-key": "value"}, Update: map[string]string{"Department": "Accounting"}},
5959
"nsg_ids": acctest.Representation{RepType: acctest.Optional, Create: []string{`${oci_core_network_security_group.test_network_security_group.id}`}},
60+
"security_attributes": acctest.Representation{RepType: acctest.Optional, Create: map[string]map[string]map[string]string{"Oracle-ZPR": {"fleet-update": {"value": "42", "mode": "enforce"}}}},
6061
"oci_cache_config_set_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_redis_oci_cache_config_set.test_oci_cache_config_set.id}`},
6162
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Required, Group: ignoreRedisTagsChangesRepresentation},
6263
}

internal/service/redis/redis_redis_cluster_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ func (s *RedisRedisClusterDataSourceCrud) SetData() error {
130130
s.D.Set("replicas_fqdn", *s.Res.ReplicasFqdn)
131131
}
132132

133+
if s.Res.SecurityAttributes != nil {
134+
s.D.Set("security_attributes", s.Res.SecurityAttributes)
135+
}
136+
133137
if s.Res.ShardCount != nil {
134138
s.D.Set("shard_count", *s.Res.ShardCount)
135139
}

internal/service/redis/redis_redis_cluster_resource.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ func RedisRedisClusterResource() *schema.Resource {
9292
Optional: true,
9393
Computed: true,
9494
},
95+
"security_attributes": {
96+
Type: schema.TypeMap,
97+
Optional: true,
98+
Computed: true,
99+
Elem: schema.TypeString,
100+
},
95101
"shard_count": {
96102
Type: schema.TypeInt,
97103
Optional: true,
@@ -315,6 +321,10 @@ func (s *RedisRedisClusterResourceCrud) Create() error {
315321
request.OciCacheConfigSetId = &tmp
316322
}
317323

324+
if securityAttributes, ok := s.D.GetOkExists("security_attributes"); ok {
325+
request.SecurityAttributes = securityAttributes.(map[string]map[string]interface{})
326+
}
327+
318328
if shardCount, ok := s.D.GetOkExists("shard_count"); ok {
319329
tmp := shardCount.(int)
320330
request.ShardCount = &tmp
@@ -710,6 +720,12 @@ func (s *RedisRedisClusterResourceCrud) SetData() error {
710720
s.D.Set("replicas_fqdn", *s.Res.ReplicasFqdn)
711721
}
712722

723+
if s.Res.SecurityAttributes != nil {
724+
s.D.Set("security_attributes", s.Res.SecurityAttributes)
725+
} else {
726+
s.D.Set("security_attributes", map[string]interface{}{})
727+
}
728+
713729
if s.Res.ShardCount != nil {
714730
s.D.Set("shard_count", *s.Res.ShardCount)
715731
}
@@ -840,6 +856,12 @@ func RedisClusterSummaryToMap(obj oci_redis.RedisClusterSummary, datasource bool
840856
result["replicas_fqdn"] = string(*obj.ReplicasFqdn)
841857
}
842858

859+
if obj.SecurityAttributes != nil {
860+
result["security_attributes"] = obj.SecurityAttributes
861+
} else {
862+
result["security_attributes"] = map[string]interface{}{}
863+
}
864+
843865
if obj.ShardCount != nil {
844866
result["shard_count"] = int(*obj.ShardCount)
845867
}

website/docs/d/redis_redis_cluster.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The following attributes are exported:
5454
* `primary_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's primary node.
5555
* `replicas_endpoint_ip_address` - The private IP address of the API endpoint for the cluster's replica nodes.
5656
* `replicas_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's replica nodes.
57+
* `security_attributes` - Security attributes for redis cluster resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "enforce"}}}`
5758
* `shard_count` - The number of shards in a sharded cluster. Only applicable when clusterMode is SHARDED.
5859
* `software_version` - The Oracle Cloud Infrastructure Cache engine version that the cluster is running.
5960
* `state` - The current state of the cluster.

website/docs/d/redis_redis_clusters.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The following attributes are exported:
6868
* `primary_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's primary node.
6969
* `replicas_endpoint_ip_address` - The private IP address of the API endpoint for the cluster's replica nodes.
7070
* `replicas_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's replica nodes.
71+
* `security_attributes` - Security attributes for redis cluster resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "enforce"}}}`
7172
* `shard_count` - The number of shards in a sharded cluster. Only applicable when clusterMode is SHARDED.
7273
* `software_version` - The Oracle Cloud Infrastructure Cache engine version that the cluster is running.
7374
* `state` - The current state of the cluster.

website/docs/r/redis_redis_cluster.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ resource "oci_redis_redis_cluster" "test_redis_cluster" {
3131
freeform_tags = {"bar-key"= "value"}
3232
nsg_ids = var.redis_cluster_nsg_ids
3333
oci_cache_config_set_id = oci_redis_oci_cache_config_set.test_oci_cache_config_set.id
34+
security_attributes = var.redis_cluster_security_attributes
3435
shard_count = var.redis_cluster_shard_count
3536
}
3637
```
@@ -48,6 +49,7 @@ The following arguments are supported:
4849
* `node_memory_in_gbs` - (Required) (Updatable) The amount of memory allocated to the cluster's nodes, in gigabytes.
4950
* `nsg_ids` - (Optional) (Updatable) A list of Network Security Group (NSG) [OCIDs](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) associated with this cluster. For more information, see [Using an NSG for Clusters](https://docs.cloud.oracle.com/iaas/Content/ocicache/connecttocluster.htm#connecttocluster__networksecuritygroup).
5051
* `oci_cache_config_set_id` - (Optional) (Updatable) The ID of the corresponding Oracle Cloud Infrastructure Cache Config Set for the cluster.
52+
* `security_attributes` - (Optional) (Updatable) Security attributes for redis cluster resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "enforce"}}}`
5153
* `shard_count` - (Optional) (Updatable) The number of shards in sharded cluster. Only applicable when clusterMode is SHARDED.
5254
* `software_version` - (Required) (Updatable) The Oracle Cloud Infrastructure Cache engine version that the cluster is running.
5355
* `subnet_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm#Oracle) of the cluster's subnet.
@@ -82,6 +84,7 @@ The following attributes are exported:
8284
* `primary_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's primary node.
8385
* `replicas_endpoint_ip_address` - The private IP address of the API endpoint for the cluster's replica nodes.
8486
* `replicas_fqdn` - The fully qualified domain name (FQDN) of the API endpoint for the cluster's replica nodes.
87+
* `security_attributes` - Security attributes for redis cluster resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "enforce"}}}`
8588
* `shard_count` - The number of shards in a sharded cluster. Only applicable when clusterMode is SHARDED.
8689
* `software_version` - The Oracle Cloud Infrastructure Cache engine version that the cluster is running.
8790
* `state` - The current state of the cluster.

0 commit comments

Comments
 (0)