Skip to content

Commit 0affffb

Browse files
destinjoSrividyaKamakshi
authored andcommitted
Added - Support for ZPR Security Attributes
1 parent dcce0f7 commit 0affffb

10 files changed

+53
-19
lines changed

internal/integrationtest/database_tools_database_tools_private_endpoint_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ var (
5959
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"bar-key": "value"}, Update: map[string]string{"Department": "Accounting"}},
6060
"nsg_ids": acctest.Representation{RepType: acctest.Optional, Create: []string{`${oci_core_network_security_group.test_network_security_group.id}`}},
6161
"private_endpoint_ip": acctest.Representation{RepType: acctest.Optional, Create: `10.0.0.4`},
62+
"security_attributes": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"oracle-zpr.MaxEgressCount.value": "42", "oracle-zpr.MaxEgressCount.mode": "enforce"}, Update: map[string]string{"oracle-zpr.MaxEgressCount.value": "1", "oracle-zpr.MaxEgressCount.mode": "enforce"}}, // "{\"maxegresscount\": {\"value\": \"42\", \"mode\": \"audit\"}}"}},
6263
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Required, Group: ignoreChangesDatabaseToolsPrivateEndpointRepresentation},
6364
}
6465

@@ -137,6 +138,7 @@ func TestDatabaseToolsDatabaseToolsPrivateEndpointResource_basic(t *testing.T) {
137138
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
138139
resource.TestCheckResourceAttrSet(resourceName, "id"),
139140
resource.TestCheckResourceAttr(resourceName, "private_endpoint_ip", "10.0.0.4"),
141+
resource.TestCheckResourceAttr(resourceName, "security_attributes.%", "2"),
140142
resource.TestCheckResourceAttrSet(resourceName, "state"),
141143
resource.TestCheckResourceAttrSet(resourceName, "subnet_id"),
142144
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
@@ -171,6 +173,7 @@ func TestDatabaseToolsDatabaseToolsPrivateEndpointResource_basic(t *testing.T) {
171173
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
172174
resource.TestCheckResourceAttrSet(resourceName, "id"),
173175
resource.TestCheckResourceAttr(resourceName, "private_endpoint_ip", "10.0.0.4"),
176+
resource.TestCheckResourceAttr(resourceName, "security_attributes.%", "2"),
174177
resource.TestCheckResourceAttrSet(resourceName, "state"),
175178
resource.TestCheckResourceAttrSet(resourceName, "subnet_id"),
176179
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
@@ -200,6 +203,7 @@ func TestDatabaseToolsDatabaseToolsPrivateEndpointResource_basic(t *testing.T) {
200203
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
201204
resource.TestCheckResourceAttrSet(resourceName, "id"),
202205
resource.TestCheckResourceAttr(resourceName, "private_endpoint_ip", "10.0.0.4"),
206+
resource.TestCheckResourceAttr(resourceName, "security_attributes.%", "2"),
203207
resource.TestCheckResourceAttrSet(resourceName, "state"),
204208
resource.TestCheckResourceAttrSet(resourceName, "subnet_id"),
205209
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
@@ -251,6 +255,7 @@ func TestDatabaseToolsDatabaseToolsPrivateEndpointResource_basic(t *testing.T) {
251255
resource.TestCheckResourceAttr(singularDatasourceName, "private_endpoint_ip", "10.0.0.4"),
252256
resource.TestCheckResourceAttrSet(singularDatasourceName, "private_endpoint_vnic_id"),
253257
resource.TestCheckResourceAttr(singularDatasourceName, "reverse_connection_configuration.#", "1"),
258+
resource.TestCheckResourceAttr(singularDatasourceName, "security_attributes.%", "2"),
254259
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),
255260
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
256261
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_updated"),
@@ -265,8 +270,7 @@ func TestDatabaseToolsDatabaseToolsPrivateEndpointResource_basic(t *testing.T) {
265270
ImportStateVerifyIgnore: []string{},
266271
ResourceName: resourceName,
267272
},
268-
},
269-
})
273+
}})
270274
}
271275

272276
func testAccCheckDatabaseToolsDatabaseToolsPrivateEndpointDestroy(s *terraform.State) error {

internal/service/database_tools/database_tools_database_tools_private_endpoint_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ func (s *DatabaseToolsDatabaseToolsPrivateEndpointDataSourceCrud) SetData() erro
120120
s.D.Set("reverse_connection_configuration", nil)
121121
}
122122

123+
if s.Res.SecurityAttributes != nil {
124+
s.D.Set("security_attributes", tfresource.SecurityAttributesToMap(s.Res.SecurityAttributes))
125+
}
126+
123127
s.D.Set("state", s.Res.LifecycleState)
124128

125129
if s.Res.SubnetId != nil {

internal/service/database_tools/database_tools_database_tools_private_endpoint_resource.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ func DatabaseToolsDatabaseToolsPrivateEndpointResource() *schema.Resource {
123123
Computed: true,
124124
ForceNew: true,
125125
},
126+
"security_attributes": {
127+
Type: schema.TypeMap,
128+
Optional: true,
129+
Computed: true,
130+
Elem: schema.TypeString,
131+
},
126132

127133
// Computed
128134
"additional_fqdns": {
@@ -338,6 +344,10 @@ func (s *DatabaseToolsDatabaseToolsPrivateEndpointResourceCrud) Create() error {
338344
request.PrivateEndpointIp = &tmp
339345
}
340346

347+
if securityAttributes, ok := s.D.GetOkExists("security_attributes"); ok {
348+
request.SecurityAttributes = tfresource.MapToSecurityAttributes(securityAttributes.(map[string]interface{}))
349+
}
350+
341351
if subnetId, ok := s.D.GetOkExists("subnet_id"); ok {
342352
tmp := subnetId.(string)
343353
request.SubnetId = &tmp
@@ -547,6 +557,10 @@ func (s *DatabaseToolsDatabaseToolsPrivateEndpointResourceCrud) Update() error {
547557
}
548558
}
549559

560+
if securityAttributes, ok := s.D.GetOkExists("security_attributes"); ok {
561+
request.SecurityAttributes = tfresource.MapToSecurityAttributes(securityAttributes.(map[string]interface{}))
562+
}
563+
550564
request.RequestMetadata.RetryPolicy = tfresource.GetRetryPolicy(s.DisableNotFoundRetries, "database_tools")
551565

552566
response, err := s.Client.UpdateDatabaseToolsPrivateEndpoint(context.Background(), request)
@@ -642,6 +656,9 @@ func (s *DatabaseToolsDatabaseToolsPrivateEndpointResourceCrud) SetData() error
642656
s.D.Set("reverse_connection_configuration", nil)
643657
}
644658

659+
if s.Res.SecurityAttributes != nil {
660+
s.D.Set("security_attributes", tfresource.SecurityAttributesToMap(s.Res.SecurityAttributes))
661+
}
645662
s.D.Set("state", s.Res.LifecycleState)
646663

647664
if s.Res.SubnetId != nil {
@@ -756,6 +773,10 @@ func DatabaseToolsPrivateEndpointSummaryToMap(obj oci_database_tools.DatabaseToo
756773
result["reverse_connection_configuration"] = []interface{}{DatabaseToolsPrivateEndpointReverseConnectionConfigurationToMap(obj.ReverseConnectionConfiguration)}
757774
}
758775

776+
if obj.SecurityAttributes != nil {
777+
result["security_attributes"] = tfresource.SecurityAttributesToMap(obj.SecurityAttributes)
778+
}
779+
759780
result["state"] = string(obj.LifecycleState)
760781

761782
if obj.SubnetId != nil {

website/docs/d/database_tools_database_tools_connection.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The following attributes are exported:
5858
* `proxy_authentication_type` - The proxy authentication type.
5959
* `roles` - A list of database roles for the client. These roles are enabled if the proxy is authorized to use the roles on behalf of the client.
6060
* `user_name` - The user name.
61-
* `user_password` - The user password.
61+
* `user_password` - The database user password.
6262
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
6363
* `value_type` - The value type of the user password.
6464
* `related_resource` - A related resource
@@ -68,11 +68,11 @@ The following attributes are exported:
6868
* `state` - The current state of the Database Tools connection.
6969
* `system_tags` - Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud.free-tier-retained": "true"}`
7070
* `time_created` - The time the Database Tools connection was created. An RFC3339 formatted datetime string.
71-
* `time_updated` - The time the DatabaseToolsConnection was updated. An RFC3339 formatted datetime string.
71+
* `time_updated` - The time the Database Tools connection was updated. An RFC3339 formatted datetime string.
7272
* `type` - The Database Tools connection type.
7373
* `url` - The JDBC URL used to connect to the Generic JDBC database system.
7474
* `user_name` - The database user name.
75-
* `user_password` - The user password.
75+
* `user_password` - The database user password.
7676
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
7777
* `value_type` - The value type of the user password.
7878

website/docs/d/database_tools_database_tools_connections.html.markdown

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ data "oci_database_tools_database_tools_connections" "test_database_tools_connec
3333

3434
The following arguments are supported:
3535

36-
* `compartment_id` - (Required) The ID of the compartment in which to list resources.
36+
* `compartment_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources.
3737
* `display_name` - (Optional) A filter to return only resources that match the entire specified display name.
38-
* `related_resource_identifier` - (Optional) A filter to return only resources associated to the related resource identifier OCID passed in the query string.
39-
* `runtime_support` - (Optional) A filter to return only resources with one of the specified runtimeSupport values.
38+
* `related_resource_identifier` - (Optional) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the related resource.
39+
* `runtime_support` - (Optional) A filter to return only resources with one of the specified type values.
4040
* `state` - (Optional) A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.
4141
* `type` - (Optional) A filter to return only resources their type matches the specified type.
4242

@@ -77,7 +77,7 @@ The following attributes are exported:
7777
* `proxy_authentication_type` - The proxy authentication type.
7878
* `roles` - A list of database roles for the client. These roles are enabled if the proxy is authorized to use the roles on behalf of the client.
7979
* `user_name` - The user name.
80-
* `user_password` - The user password.
80+
* `user_password` - The database user password.
8181
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
8282
* `value_type` - The value type of the user password.
8383
* `related_resource` - A related resource
@@ -87,11 +87,11 @@ The following attributes are exported:
8787
* `state` - The current state of the Database Tools connection.
8888
* `system_tags` - Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud.free-tier-retained": "true"}`
8989
* `time_created` - The time the Database Tools connection was created. An RFC3339 formatted datetime string.
90-
* `time_updated` - The time the DatabaseToolsConnection was updated. An RFC3339 formatted datetime string.
90+
* `time_updated` - The time the Database Tools connection was updated. An RFC3339 formatted datetime string.
9191
* `type` - The Database Tools connection type.
9292
* `url` - The JDBC URL used to connect to the Generic JDBC database system.
9393
* `user_name` - The database user name.
94-
* `user_password` - The user password.
94+
* `user_password` - The database user password.
9595
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
9696
* `value_type` - The value type of the user password.
9797

website/docs/d/database_tools_database_tools_endpoint_services.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ data "oci_database_tools_database_tools_endpoint_services" "test_database_tools_
3131

3232
The following arguments are supported:
3333

34-
* `compartment_id` - (Required) The ID of the compartment in which to list resources.
34+
* `compartment_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources.
3535
* `display_name` - (Optional) A filter to return only resources that match the entire specified display name.
3636
* `name` - (Optional) A filter to return only resources that match the entire specified name.
3737
* `state` - (Optional) A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.

website/docs/d/database_tools_database_tools_private_endpoint.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The following attributes are exported:
5353
* `reverse_connection_configuration` - Reverse connection configuration details of the private endpoint.
5454
* `reverse_connections_source_ips` - A list of IP addresses in the customer VCN to be used as the source IPs for reverse connection packets traveling from the service's VCN to the customer's VCN.
5555
* `source_ip` - The IP address in the customer's VCN to be used as the source IP for reverse connection packets traveling from the customer's VCN to the service's VCN.
56+
* `security_attributes` - Zero trust Packet Routing (ZPR) Security Attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [ZPR Artifacts](https://docs.oracle.com/en-us/iaas/Content/zero-trust-packet-routing/zpr-artifacts.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "audit"}}}`
5657
* `state` - The current state of the Database Tools private endpoint.
5758
* `subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet that the private endpoint belongs to.
5859
* `system_tags` - Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud.free-tier-retained": "true"}`

website/docs/d/database_tools_database_tools_private_endpoints.html.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ data "oci_database_tools_database_tools_private_endpoints" "test_database_tools_
3232

3333
The following arguments are supported:
3434

35-
* `compartment_id` - (Required) The ID of the compartment in which to list resources.
35+
* `compartment_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources.
3636
* `display_name` - (Optional) A filter to return only resources that match the entire specified display name.
3737
* `endpoint_service_id` - (Optional) A filter to return only resources their `endpointServiceId` matches the specified `endpointServiceId`.
3838
* `state` - (Optional) A filter to return only resources their `lifecycleState` matches the specified `lifecycleState`.
@@ -70,6 +70,7 @@ The following attributes are exported:
7070
* `reverse_connection_configuration` - Reverse connection configuration details of the private endpoint.
7171
* `reverse_connections_source_ips` - A list of IP addresses in the customer VCN to be used as the source IPs for reverse connection packets traveling from the service's VCN to the customer's VCN.
7272
* `source_ip` - The IP address in the customer's VCN to be used as the source IP for reverse connection packets traveling from the customer's VCN to the service's VCN.
73+
* `security_attributes` - Zero trust Packet Routing (ZPR) Security Attributes for this resource. Each key is predefined and scoped to a namespace. For more information, see [ZPR Artifacts](https://docs.oracle.com/en-us/iaas/Content/zero-trust-packet-routing/zpr-artifacts.htm). Example: `{"Oracle-ZPR": {"MaxEgressCount": {"value": "42", "mode": "audit"}}}`
7374
* `state` - The current state of the Database Tools private endpoint.
7475
* `subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet that the private endpoint belongs to.
7576
* `system_tags` - Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud.free-tier-retained": "true"}`

website/docs/r/database_tools_database_tools_connection.html.markdown

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ The following arguments are supported:
110110
* `proxy_authentication_type` - (Required) (Updatable) The proxy authentication type.
111111
* `roles` - (Applicable when proxy_authentication_type=USER_NAME) (Updatable) A list of database roles for the client. These roles are enabled if the proxy is authorized to use the roles on behalf of the client.
112112
* `user_name` - (Required when proxy_authentication_type=USER_NAME) (Updatable) The user name.
113-
* `user_password` - (Applicable when proxy_authentication_type=USER_NAME) (Updatable) The user password.
113+
* `user_password` - (Applicable when proxy_authentication_type=USER_NAME) (Updatable) The database user password.
114114
* `secret_id` - (Required) (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
115115
* `value_type` - (Required) (Updatable) The value type of the user password.
116116
* `related_resource` - (Applicable when type=MYSQL | ORACLE_DATABASE | POSTGRESQL) (Updatable) The related resource
117117
* `entity_type` - (Required when type=MYSQL | ORACLE_DATABASE | POSTGRESQL) (Updatable) The resource entity type.
118118
* `identifier` - (Required when type=MYSQL | ORACLE_DATABASE | POSTGRESQL) (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the related resource.
119119
* `runtime_support` - (Optional) Specifies whether this connection is supported by the Database Tools Runtime.
120-
* `type` - (Required) (Updatable) The DatabaseToolsConnection type.
120+
* `type` - (Required) (Updatable) The Database Tools connection type.
121121
* `url` - (Required when type=GENERIC_JDBC) (Updatable) The JDBC URL used to connect to the Generic JDBC database system.
122122
* `user_name` - (Required) (Updatable) The database user name.
123-
* `user_password` - (Required) (Updatable) The user password.
123+
* `user_password` - (Required) (Updatable) The database user password.
124124
* `secret_id` - (Required) (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
125125
* `value_type` - (Required) (Updatable) The value type of the user password.
126126

@@ -158,7 +158,7 @@ The following attributes are exported:
158158
* `proxy_authentication_type` - The proxy authentication type.
159159
* `roles` - A list of database roles for the client. These roles are enabled if the proxy is authorized to use the roles on behalf of the client.
160160
* `user_name` - The user name.
161-
* `user_password` - The user password.
161+
* `user_password` - The database user password.
162162
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
163163
* `value_type` - The value type of the user password.
164164
* `related_resource` - A related resource
@@ -168,11 +168,11 @@ The following attributes are exported:
168168
* `state` - The current state of the Database Tools connection.
169169
* `system_tags` - Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud.free-tier-retained": "true"}`
170170
* `time_created` - The time the Database Tools connection was created. An RFC3339 formatted datetime string.
171-
* `time_updated` - The time the DatabaseToolsConnection was updated. An RFC3339 formatted datetime string.
171+
* `time_updated` - The time the Database Tools connection was updated. An RFC3339 formatted datetime string.
172172
* `type` - The Database Tools connection type.
173173
* `url` - The JDBC URL used to connect to the Generic JDBC database system.
174174
* `user_name` - The database user name.
175-
* `user_password` - The user password.
175+
* `user_password` - The database user password.
176176
* `secret_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the secret containing the user password.
177177
* `value_type` - The value type of the user password.
178178

0 commit comments

Comments
 (0)