Skip to content

Commit 3275297

Browse files
Tong Linvsin12
authored andcommitted
Added - Support for ACD & OKV Wallet Naming | ADB-D & ADB-C@C
1 parent a1bbaf0 commit 3275297

11 files changed

+45
-5
lines changed

examples/database/atp-d/exadata.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ resource "oci_database_cloud_autonomous_vm_cluster" "test_cloud_autonomous_vm_cl
7171
license_model = "LICENSE_INCLUDED"
7272
subnet_id = oci_core_subnet.exadata_subnet.id
7373
#Optional
74-
autonomous_data_storage_size_in_tbs = 5
75-
memory_per_oracle_compute_unit_in_gbs = 27
76-
cpu_core_count_per_node = 50
77-
total_container_databases = 12
74+
# autonomous_data_storage_size_in_tbs = 5
75+
# memory_per_oracle_compute_unit_in_gbs = 27
76+
# cpu_core_count_per_node = 50
77+
# total_container_databases = 12
7878
compute_model = "ECPU"
7979
}
8080

examples/database/atp-d/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ resource "oci_database_autonomous_container_database" "test_autonomous_container
1414
cloud_autonomous_vm_cluster_id = oci_database_cloud_autonomous_vm_cluster.test_cloud_autonomous_vm_cluster.id
1515
display_name = "example-container-database"
1616
patch_model = "RELEASE_UPDATES"
17+
db_version = "19.18.0.1.0"
18+
db_name = "acdname"
1719

1820
#Optional
1921
backup_config {

examples/database/exadata_cc/adbd/adb.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resource "oci_database_autonomous_database" "test_autonomous_database" {
1010
#Required
1111
admin_password = random_string.autonomous_database_admin_password.result
1212
compartment_id = var.compartment_ocid
13-
compute_count = "2"
13+
compute_count = "2"
1414
data_storage_size_in_tbs = "1"
1515
db_name = "atpdb1"
1616

internal/integrationtest/database_autonomous_container_database_resource_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ var (
4545
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
4646
"maintenance_window_details": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DatabaseAutonomousContainerDatabaseMaintenanceWindowDetailsRepresentation},
4747
"service_level_agreement_type": acctest.Representation{RepType: acctest.Optional, Create: `STANDARD`},
48+
"db_name": acctest.Representation{RepType: acctest.Optional, Create: `DBNAME`},
49+
"db_version": acctest.Representation{RepType: acctest.Required, Create: `19.18.0.1.0`},
4850
}
4951

5052
ACDatabaseBackupConfigRepresentation = map[string]interface{}{
@@ -131,6 +133,7 @@ func TestDatabaseExaccAutonomousContainerDatabase_basic(t *testing.T) {
131133
resource.TestCheckResourceAttrSet(resourceName, "state"),
132134
resource.TestCheckResourceAttr(resourceName, "version_preference", "LATEST_RELEASE_UPDATE"),
133135
resource.TestCheckResourceAttrSet(resourceName, "db_version"),
136+
resource.TestCheckResourceAttr(resourceName, "db_name", "DBNAME"),
134137

135138
func(s *terraform.State) (err error) {
136139
resId, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -177,6 +180,7 @@ func TestDatabaseExaccAutonomousContainerDatabase_basic(t *testing.T) {
177180
resource.TestCheckResourceAttrSet(resourceName, "state"),
178181
resource.TestCheckResourceAttr(resourceName, "version_preference", "NEXT_RELEASE_UPDATE"),
179182
resource.TestCheckResourceAttrSet(resourceName, "db_version"),
183+
resource.TestCheckResourceAttr(resourceName, "db_name", "DBNAME"),
180184

181185
func(s *terraform.State) (err error) {
182186
resId2, err = acctest.FromInstanceState(s, resourceName, "id")

internal/integrationtest/database_autonomous_container_database_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ var (
6565
"maintenance_window_details": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DatabaseAutonomousContainerDatabaseMaintenanceWindowDetailsRepresentation},
6666
"service_level_agreement_type": acctest.Representation{RepType: acctest.Optional, Create: `STANDARD`},
6767
"vault_id": acctest.Representation{RepType: acctest.Optional, Create: `${data.oci_kms_vault.test_vault.id}`},
68+
"db_name": acctest.Representation{RepType: acctest.Optional, Create: `DBNAME`},
6869
}
6970

7071
DatabaseAutonomousContainerDatabaseBackupConfigRepresentation = map[string]interface{}{
@@ -209,6 +210,7 @@ func TestDatabaseAutonomousContainerDatabaseResource_basic(t *testing.T) {
209210
resource.TestCheckResourceAttrSet(resourceName, "state"),
210211
resource.TestCheckResourceAttrSet(resourceName, "vault_id"),
211212
resource.TestCheckResourceAttr(resourceName, "version_preference", "LATEST_RELEASE_UPDATE"),
213+
resource.TestCheckResourceAttr(resourceName, "db_name", "DBNAME"),
212214

213215
func(s *terraform.State) (err error) {
214216
resId, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -269,6 +271,7 @@ func TestDatabaseAutonomousContainerDatabaseResource_basic(t *testing.T) {
269271
resource.TestCheckResourceAttrSet(resourceName, "state"),
270272
resource.TestCheckResourceAttrSet(resourceName, "vault_id"),
271273
resource.TestCheckResourceAttr(resourceName, "version_preference", "LATEST_RELEASE_UPDATE"),
274+
resource.TestCheckResourceAttr(resourceName, "db_name", "DBNAME"),
272275

273276
func(s *terraform.State) (err error) {
274277
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -324,6 +327,7 @@ func TestDatabaseAutonomousContainerDatabaseResource_basic(t *testing.T) {
324327
resource.TestCheckResourceAttrSet(resourceName, "state"),
325328
resource.TestCheckResourceAttrSet(resourceName, "vault_id"),
326329
resource.TestCheckResourceAttr(resourceName, "version_preference", "NEXT_RELEASE_UPDATE"),
330+
resource.TestCheckResourceAttr(resourceName, "db_name", "DBNAME"),
327331

328332
func(s *terraform.State) (err error) {
329333
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -379,6 +383,7 @@ func TestDatabaseAutonomousContainerDatabaseResource_basic(t *testing.T) {
379383
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_container_databases.0.total_cpus"),
380384
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_container_databases.0.vault_id"),
381385
resource.TestCheckResourceAttr(datasourceName, "autonomous_container_databases.0.version_preference", "NEXT_RELEASE_UPDATE"),
386+
resource.TestCheckResourceAttr(datasourceName, "autonomous_container_databases.0.db_name", "DBNAME"),
382387
),
383388
},
384389
// verify singular datasource
@@ -417,6 +422,7 @@ func TestDatabaseAutonomousContainerDatabaseResource_basic(t *testing.T) {
417422
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
418423
resource.TestCheckResourceAttrSet(singularDatasourceName, "total_cpus"),
419424
resource.TestCheckResourceAttr(singularDatasourceName, "version_preference", "NEXT_RELEASE_UPDATE"),
425+
resource.TestCheckResourceAttr(singularDatasourceName, "db_name", "DBNAME"),
420426
),
421427
},
422428

internal/service/database/database_autonomous_container_database_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ func (s *DatabaseAutonomousContainerDatabaseDataSourceCrud) SetData() error {
9898

9999
s.D.Set("compute_model", s.Res.ComputeModel)
100100

101+
if s.Res.DbName != nil {
102+
s.D.Set("db_name", *s.Res.DbName)
103+
}
104+
101105
if s.Res.DbUniqueName != nil {
102106
s.D.Set("db_unique_name", *s.Res.DbUniqueName)
103107
}

internal/service/database/database_autonomous_container_database_resource.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ func DatabaseAutonomousContainerDatabaseResource() *schema.Resource {
126126
Optional: true,
127127
Computed: true,
128128
},
129+
"db_name": {
130+
Type: schema.TypeString,
131+
Optional: true,
132+
Computed: true,
133+
ForceNew: true,
134+
},
129135
"db_unique_name": {
130136
Type: schema.TypeString,
131137
Optional: true,
@@ -748,6 +754,11 @@ func (s *DatabaseAutonomousContainerDatabaseResourceCrud) Create() error {
748754
request.CompartmentId = &tmp
749755
}
750756

757+
if dbName, ok := s.D.GetOkExists("db_name"); ok {
758+
tmp := dbName.(string)
759+
request.DbName = &tmp
760+
}
761+
751762
if dbUniqueName, ok := s.D.GetOkExists("db_unique_name"); ok {
752763
tmp := dbUniqueName.(string)
753764
request.DbUniqueName = &tmp
@@ -1040,6 +1051,10 @@ func (s *DatabaseAutonomousContainerDatabaseResourceCrud) SetData() error {
10401051

10411052
s.D.Set("compute_model", s.Res.ComputeModel)
10421053

1054+
if s.Res.DbName != nil {
1055+
s.D.Set("db_name", *s.Res.DbName)
1056+
}
1057+
10431058
if s.Res.DbVersion != nil {
10441059
s.D.Set("db_version", *s.Res.DbVersion)
10451060
}

internal/service/database/database_autonomous_container_databases_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ func (s *DatabaseAutonomousContainerDatabasesDataSourceCrud) SetData() error {
191191

192192
autonomousContainerDatabase["compute_model"] = r.ComputeModel
193193

194+
if r.DbName != nil {
195+
autonomousContainerDatabase["db_name"] = *r.DbName
196+
}
197+
194198
if r.DbUniqueName != nil {
195199
autonomousContainerDatabase["db_unique_name"] = *r.DbUniqueName
196200
}

website/docs/d/database_autonomous_container_database.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The following attributes are exported:
4747
* `recovery_window_in_days` - Number of days between the current and the earliest point of recoverability covered by automatic backups. This value applies to automatic backups. After a new automatic backup has been created, Oracle removes old automatic backups that are created before the window. When the value is updated, it is applied to all existing automatic backups.
4848
* `cloud_autonomous_vm_cluster_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cloud Autonomous Exadata VM Cluster.
4949
* `compartment_id` - The OCID of the compartment.
50+
* `db_name` - The database name for the Autonomous Container Database. The name must be unique within the Cloud Autonomous VM Cluster, must start with an alphabetic character and followed by 1 to 7 alphanumeric characters.
5051
* `db_unique_name` - **Deprecated.** The `DB_UNIQUE_NAME` value is set by Oracle Cloud Infrastructure. Do not specify a value for this parameter. Specifying a value for this field will cause Terraform operations to fail.
5152
* `db_version` - Oracle Database version of the Autonomous Container Database.
5253
* `defined_tags` - Defined tags for this 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).

website/docs/d/database_autonomous_container_databases.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ The following attributes are exported:
7272
* `recovery_window_in_days` - Number of days between the current and the earliest point of recoverability covered by automatic backups. This value applies to automatic backups. After a new automatic backup has been created, Oracle removes old automatic backups that are created before the window. When the value is updated, it is applied to all existing automatic backups.
7373
* `cloud_autonomous_vm_cluster_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cloud Autonomous Exadata VM Cluster.
7474
* `compartment_id` - The OCID of the compartment.
75+
* `db_name` - The database name for the Autonomous Container Database. The name must be unique within the Cloud Autonomous VM Cluster, must start with an alphabetic character and followed by 1 to 7 alphanumeric characters.
7576
* `db_unique_name` - **Deprecated.** The `DB_UNIQUE_NAME` value is set by Oracle Cloud Infrastructure. Do not specify a value for this parameter. Specifying a value for this field will cause Terraform operations to fail.
7677
* `db_version` - Oracle Database version of the Autonomous Container Database.
7778
* `defined_tags` - Defined tags for this 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).

0 commit comments

Comments
 (0)