Skip to content

Commit 218b1ec

Browse files
KavyaKS94sagarp337
authored andcommitted
Added - Support for Datbase External TCPS
1 parent 3c51b68 commit 218b1ec

14 files changed

+523
-10
lines changed

examples/database/external_databases/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ variable "service" {
7373
}
7474

7575
variable "connector_agent_id" {
76-
default = "ocid1.managementagent.oc1.phx.amaaaaaajobtc3iaes4ijczgekzqigoji25xocsny7yundummydummydummy"
76+
7777
}
7878

7979
variable "external_database_connector_display_name" {

internal/integrationtest/database_external_database_connector_tcps_test.go

Lines changed: 417 additions & 0 deletions
Large diffs are not rendered by default.

internal/integrationtest/database_external_database_connector_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ func TestDatabaseExternalDatabaseConnectorResource_basic(t *testing.T) {
256256
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
257257
),
258258
},
259+
260+
// remove singular datasource from previous step so that it doesn't conflict with import tests
261+
{
262+
Config: config + compartmentIdVariableStr + agentIdVariableStr + ExternalDatabaseConnectorResourceConfig,
263+
},
264+
259265
// verify resource import
260266
{
261267
Config: config + ExternalDatabaseConnectorRequiredOnlyResource,

internal/service/database/database_external_database_connector_data_source.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,26 @@ func (s *DatabaseExternalDatabaseConnectorDataSourceCrud) DatabaseConnectionCred
158158
if v.CredentialName != nil {
159159
result["credential_name"] = string(*v.CredentialName)
160160
}
161+
case oci_database.DatabaseSslConnectionCredentials:
162+
result["credential_type"] = "SSL_DETAILS"
163+
164+
if v.CredentialName != nil {
165+
result["credential_name"] = string(*v.CredentialName)
166+
}
167+
168+
if password, ok := s.D.GetOkExists("connection_credentials.0.password"); ok && password != nil {
169+
result["password"] = password.(string)
170+
}
171+
172+
result["role"] = string(v.Role)
173+
174+
if v.SslSecretId != nil {
175+
result["ssl_secret_id"] = string(*v.SslSecretId)
176+
}
177+
178+
if username, ok := s.D.GetOkExists("connection_credentials.0.username"); ok && username != nil {
179+
result["username"] = username.(string)
180+
}
161181
default:
162182
log.Printf("[WARN] Received 'credential_type' of unknown type %v", *obj)
163183
return nil

internal/service/database/database_external_database_connector_resource.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func DatabaseExternalDatabaseConnectorResource() *schema.Resource {
5353
ValidateFunc: validation.StringInSlice([]string{
5454
"DETAILS",
5555
"NAME_REFERENCE",
56+
"SSL_DETAILS",
5657
}, true),
5758
},
5859
"password": {
@@ -66,6 +67,11 @@ func DatabaseExternalDatabaseConnectorResource() *schema.Resource {
6667
Optional: true,
6768
Computed: true,
6869
},
70+
"ssl_secret_id": {
71+
Type: schema.TypeString,
72+
Optional: true,
73+
Computed: true,
74+
},
6975
"username": {
7076
Type: schema.TypeString,
7177
Optional: true,
@@ -445,6 +451,28 @@ func (s *DatabaseExternalDatabaseConnectorResourceCrud) mapToDatabaseConnectionC
445451
details.CredentialName = &tmp
446452
}
447453
baseObject = details
454+
case strings.ToLower("SSL_DETAILS"):
455+
details := oci_database.DatabaseSslConnectionCredentials{}
456+
if credentialName, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "credential_name")); ok {
457+
tmp := credentialName.(string)
458+
details.CredentialName = &tmp
459+
}
460+
if password, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "password")); ok {
461+
tmp := password.(string)
462+
details.Password = &tmp
463+
}
464+
if role, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "role")); ok {
465+
details.Role = oci_database.DatabaseSslConnectionCredentialsRoleEnum(role.(string))
466+
}
467+
if sslSecretId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "ssl_secret_id")); ok {
468+
tmp := sslSecretId.(string)
469+
details.SslSecretId = &tmp
470+
}
471+
if username, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "username")); ok {
472+
tmp := username.(string)
473+
details.Username = &tmp
474+
}
475+
baseObject = details
448476
default:
449477
return nil, fmt.Errorf("unknown credential_type '%v' was specified", credentialType)
450478
}
@@ -476,6 +504,27 @@ func (s *DatabaseExternalDatabaseConnectorResourceCrud) DatabaseConnectionCreden
476504
if v.CredentialName != nil {
477505
result["credential_name"] = string(*v.CredentialName)
478506
}
507+
case oci_database.DatabaseSslConnectionCredentials:
508+
result["credential_type"] = "SSL_DETAILS"
509+
510+
if v.CredentialName != nil {
511+
result["credential_name"] = string(*v.CredentialName)
512+
}
513+
514+
if password, ok := s.D.GetOkExists("connection_credentials.0.password"); ok && password != nil {
515+
result["password"] = password.(string)
516+
}
517+
518+
result["role"] = string(v.Role)
519+
520+
if v.SslSecretId != nil {
521+
result["ssl_secret_id"] = string(*v.SslSecretId)
522+
}
523+
524+
if username, ok := s.D.GetOkExists("connection_credentials.0.username"); ok && username != nil {
525+
result["username"] = username.(string)
526+
}
527+
479528
default:
480529
log.Printf("[WARN] Received 'credential_type' of unknown type %v", *obj)
481530
return nil

internal/service/database/database_external_database_connectors_data_source.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ func (s *DatabaseExternalDatabaseConnectorsDataSourceCrud) DatabaseConnectionCre
220220
if v.CredentialName != nil {
221221
result["credential_name"] = string(*v.CredentialName)
222222
}
223+
case oci_database.DatabaseSslConnectionCredentials:
224+
result["credential_type"] = "SSL_DETAILS"
225+
if v.CredentialName != nil {
226+
result["credential_name"] = string(*v.CredentialName)
227+
}
228+
if password, ok := s.D.GetOkExists("connection_credentials.0.password"); ok && password != nil {
229+
result["password"] = password.(string)
230+
}
231+
result["role"] = string(v.Role)
232+
if v.SslSecretId != nil {
233+
result["ssl_secret_id"] = string(*v.SslSecretId)
234+
}
235+
if username, ok := s.D.GetOkExists("connection_credentials.0.username"); ok && username != nil {
236+
result["username"] = username.(string)
237+
}
223238
default:
224239
log.Printf("[WARN] Received 'credential_type' of unknown type %v", *obj)
225240
return nil

website/docs/d/database_autonomous_container_database.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The following arguments are supported:
3232

3333
The following attributes are exported:
3434

35-
* `autonomous_exadata_infrastructure_id` - The OCID of the Autonomous Exadata Infrastructure.
35+
* `autonomous_exadata_infrastructure_id` - **No longer used.** For Autonomous Database on dedicated Exadata infrastructure, the container database is created within a specified `cloudAutonomousVmCluster`.
3636
* `autonomous_vm_cluster_id` - The OCID of the Autonomous VM Cluster.
3737
* `availability_domain` - The availability domain of the Autonomous Container Database.
3838
* `backup_config` - Backup options for the Autonomous Container Database.

website/docs/d/database_autonomous_container_databases.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The following attributes are exported:
5757

5858
The following attributes are exported:
5959

60-
* `autonomous_exadata_infrastructure_id` - The OCID of the Autonomous Exadata Infrastructure.
60+
* `autonomous_exadata_infrastructure_id` - **No longer used.** For Autonomous Database on dedicated Exadata infrastructure, the container database is created within a specified `cloudAutonomousVmCluster`.
6161
* `autonomous_vm_cluster_id` - The OCID of the Autonomous VM Cluster.
6262
* `availability_domain` - The availability domain of the Autonomous Container Database.
6363
* `backup_config` - Backup options for the Autonomous Container Database.

website/docs/d/database_autonomous_exadata_infrastructure_shapes.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: |-
1010
# Data Source: oci_database_autonomous_exadata_infrastructure_shapes
1111
This data source provides the list of Autonomous Exadata Infrastructure Shapes in Oracle Cloud Infrastructure Database service.
1212

13-
**Deprecated.**
13+
**Deprecated.**
1414

1515

1616
## Example Usage

website/docs/d/database_autonomous_vm_cluster.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: |-
1010
# Data Source: oci_database_autonomous_vm_cluster
1111
This data source provides details about a specific Autonomous Vm Cluster resource in Oracle Cloud Infrastructure Database service.
1212

13-
Gets information about the specified Autonomous VM cluster for an Exadata Cloud@Customer system. To get information about an Autonomous VM Cluster in the Oracle cloud, see [GetCloudAutonomousVmCluster](https://docs.cloud.oracle.com/iaas/api/#/en/database/latest/CloudAutonomousVmCluster/GetCloudAutonomousVmCluster).
13+
Gets information about the specified Autonomous VM cluster for an Exadata Cloud@Customer system. To get information about an Autonomous VM Cluster in the Oracle cloud, see [GetCloudAutonomousVmCluster](https://docs.cloud.oracle.com/iaas/api/#/en/database/latest/CloudAutonomousVmCluster/GetCloudAutonomousVmCluster).
1414

1515

1616
## Example Usage

0 commit comments

Comments
 (0)