Skip to content

Commit 2e857c6

Browse files
Terraform Team AutomationKhalid-Chaudhry
authored andcommitted
Added - Support for Database In-Memory support for Autonomous Database | ADB-D and ADB on ExaC@C
1 parent 9095c7c commit 2e857c6

16 files changed

+374
-45
lines changed

examples/database/atp-d/exadata.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ resource "oci_database_cloud_autonomous_vm_cluster" "test_cloud_autonomous_vm_cl
7777
# total_container_databases = 12
7878
compute_model = "ECPU"
7979

80-
//To ignore changes to autonomous_data_storage_size_in_tbs
80+
//To ignore changes to autonomous_data_storage_size_in_tbs and db_servers
8181
lifecycle {
8282
ignore_changes = [
8383
autonomous_data_storage_size_in_tbs,

examples/database/atp-d/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ 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"
17+
db_version = "19.20.0.1.0"
1818
db_name = "ACDNAME"
1919

2020
#Optional
@@ -74,7 +74,7 @@ resource "oci_database_autonomous_database" "test_autonomous_database" {
7474
#Required
7575
admin_password = random_string.autonomous_database_admin_password.result
7676
compartment_id = var.compartment_ocid
77-
compute_count = "1"
77+
compute_count = 8
7878
data_storage_size_in_tbs = "1"
7979
db_name = "atpdb1"
8080

@@ -85,6 +85,7 @@ resource "oci_database_autonomous_database" "test_autonomous_database" {
8585
freeform_tags = var.autonomous_database_freeform_tags
8686
is_dedicated = "true"
8787
rotate_key_trigger = "true"
88+
in_memory_percentage = 50
8889
compute_model = "ECPU"
8990
}
9091

examples/database/exadata_cc/adbd/acd.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resource "random_string" "db_unique_name" {
66

77
resource "oci_database_autonomous_container_database" "autonomous_container_database" {
88
autonomous_vm_cluster_id = oci_database_autonomous_vm_cluster.test_autonomous_vm_cluster.id
9-
db_version = "19.18.0.1.0"
9+
db_version = "19.20.0.1.0"
1010
backup_config {
1111
backup_destination_details {
1212
type = "LOCAL"

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-
ocpu_count = "2"
13+
compute_count = 8
1414
data_storage_size_in_tbs = "1"
1515
db_name = "atpdb1"
1616

internal/integrationtest/database_autonomous_container_database_resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var (
4646
"maintenance_window_details": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DatabaseAutonomousContainerDatabaseMaintenanceWindowDetailsRepresentation},
4747
"service_level_agreement_type": acctest.Representation{RepType: acctest.Optional, Create: `STANDARD`},
4848
"db_name": acctest.Representation{RepType: acctest.Optional, Create: `DBNAME`},
49-
"db_version": acctest.Representation{RepType: acctest.Required, Create: `19.18.0.1.0`},
49+
"db_version": acctest.Representation{RepType: acctest.Required, Create: `19.20.0.1.0`},
5050
}
5151

5252
ACDatabaseBackupConfigRepresentation = map[string]interface{}{

internal/integrationtest/database_autonomous_container_database_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var (
5454
"version_preference": acctest.Representation{RepType: acctest.Optional, Create: `LATEST_RELEASE_UPDATE`, Update: `NEXT_RELEASE_UPDATE`},
5555
"display_name": acctest.Representation{RepType: acctest.Required, Create: `containerDatabase2`, Update: `displayName2`},
5656
"patch_model": acctest.Representation{RepType: acctest.Required, Create: `RELEASE_UPDATES`, Update: `RELEASE_UPDATE_REVISIONS`},
57-
"db_version": acctest.Representation{RepType: acctest.Required, Create: `19.18.0.1.0`},
57+
"db_version": acctest.Representation{RepType: acctest.Required, Create: `19.20.0.1.0`},
5858
"cloud_autonomous_vm_cluster_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_database_cloud_autonomous_vm_cluster.test_cloud_autonomous_vm_cluster.id}`},
5959
"backup_config": acctest.RepresentationGroup{RepType: acctest.Optional, Group: ACDatabaseBackupConfigRepresentation},
6060
"compartment_id": acctest.Representation{RepType: acctest.Optional, Create: `${var.compartment_id}`},

internal/integrationtest/database_autonomous_database_resource_test.go

Lines changed: 269 additions & 33 deletions
Large diffs are not rendered by default.

internal/integrationtest/database_vm_cluster_network_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ var (
7878
"hostname": acctest.Representation{RepType: acctest.Required, Create: `myprefix1-ivmmj-scan`, Update: `myprefix2-ivmmj-scan`},
7979
"ips": acctest.Representation{RepType: acctest.Required, Create: []string{`192.168.19.7`, `192.168.19.6`, `192.168.19.8`}, Update: []string{`192.168.19.7`, `192.168.19.8`, `192.168.19.9`}},
8080
"port": acctest.Representation{RepType: acctest.Required, Create: `1521`, Update: `1522`},
81-
"scan_listener_port_tcp": acctest.Representation{RepType: acctest.Optional, Create: `1521`, Update: `1522`},
82-
"scan_listener_port_tcp_ssl": acctest.Representation{RepType: acctest.Optional, Create: `2484`, Update: `2484`},
81+
"scan_listener_port_tcp": acctest.Representation{RepType: acctest.Required, Create: `1521`, Update: `1522`},
82+
"scan_listener_port_tcp_ssl": acctest.Representation{RepType: acctest.Required, Create: `2484`, Update: `2484`},
8383
}
8484

8585
DatabaseVmClusterNetwork2ScansRepresentation = map[string]interface{}{
8686
"hostname": acctest.Representation{RepType: acctest.Required, Create: `myprefix4-ivmmj-scan`, Update: `myprefix3-ivmmj-scan`},
8787
"ips": acctest.Representation{RepType: acctest.Required, Create: []string{`192.168.19.26`, `192.168.19.27`, `192.168.19.28`}, Update: []string{`192.168.19.27`, `192.168.19.28`, `192.168.19.29`}},
8888
"port": acctest.Representation{RepType: acctest.Required, Create: `1521`, Update: `1522`},
89-
"scan_listener_port_tcp": acctest.Representation{RepType: acctest.Optional, Create: `1521`, Update: `1522`},
90-
"scan_listener_port_tcp_ssl": acctest.Representation{RepType: acctest.Optional, Create: `2484`, Update: `2484`},
89+
"scan_listener_port_tcp": acctest.Representation{RepType: acctest.Required, Create: `1521`, Update: `1522`},
90+
"scan_listener_port_tcp_ssl": acctest.Representation{RepType: acctest.Required, Create: `2484`, Update: `2484`},
9191
}
9292

9393
DatabaseVmClusterNetworkBackupVmNetworkRepresentation = map[string]interface{}{

internal/service/database/database_autonomous_database_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ func (s *DatabaseAutonomousDatabaseDataSourceCrud) SetData() error {
180180

181181
s.D.Set("freeform_tags", s.Res.FreeformTags)
182182

183+
if s.Res.InMemoryAreaInGBs != nil {
184+
s.D.Set("in_memory_area_in_gbs", *s.Res.InMemoryAreaInGBs)
185+
}
186+
187+
if s.Res.InMemoryPercentage != nil {
188+
s.D.Set("in_memory_percentage", *s.Res.InMemoryPercentage)
189+
}
190+
183191
s.D.Set("infrastructure_type", s.Res.InfrastructureType)
184192

185193
if s.Res.IsAccessControlEnabled != nil {

internal/service/database/database_autonomous_database_resource.go

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
188188
Computed: true,
189189
Elem: schema.TypeString,
190190
},
191+
"in_memory_percentage": {
192+
Type: schema.TypeInt,
193+
Optional: true,
194+
Computed: true,
195+
},
191196
"is_access_control_enabled": {
192197
Type: schema.TypeBool,
193198
Optional: true,
@@ -624,6 +629,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
624629
Type: schema.TypeInt,
625630
Computed: true,
626631
},
632+
"in_memory_area_in_gbs": {
633+
Type: schema.TypeInt,
634+
Computed: true,
635+
},
627636
"infrastructure_type": {
628637
Type: schema.TypeString,
629638
Computed: true,
@@ -1430,7 +1439,12 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) Update() error {
14301439
request.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
14311440
}
14321441

1433-
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok {
1442+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
1443+
tmp := inMemoryPercentage.(int)
1444+
request.InMemoryPercentage = &tmp
1445+
}
1446+
1447+
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok && s.D.HasChange("is_access_control_enabled") {
14341448
tmp := isAccessControlEnabled.(bool)
14351449
request.IsAccessControlEnabled = &tmp
14361450
}
@@ -1752,6 +1766,14 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) SetData() error {
17521766

17531767
s.D.Set("freeform_tags", s.Res.FreeformTags)
17541768

1769+
if s.Res.InMemoryAreaInGBs != nil {
1770+
s.D.Set("in_memory_area_in_gbs", *s.Res.InMemoryAreaInGBs)
1771+
}
1772+
1773+
if s.Res.InMemoryPercentage != nil {
1774+
s.D.Set("in_memory_percentage", *s.Res.InMemoryPercentage)
1775+
}
1776+
17551777
s.D.Set("infrastructure_type", s.Res.InfrastructureType)
17561778

17571779
if s.Res.IsAccessControlEnabled != nil {
@@ -2413,6 +2435,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
24132435
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
24142436
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
24152437
}
2438+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
2439+
tmp := inMemoryPercentage.(int)
2440+
details.InMemoryPercentage = &tmp
2441+
}
24162442
if isAutoScalingEnabled, ok := s.D.GetOkExists("is_auto_scaling_enabled"); ok {
24172443
tmp := isAutoScalingEnabled.(bool)
24182444
details.IsAutoScalingEnabled = &tmp
@@ -2652,6 +2678,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
26522678
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
26532679
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
26542680
}
2681+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
2682+
tmp := inMemoryPercentage.(int)
2683+
details.InMemoryPercentage = &tmp
2684+
}
26552685
if isAutoScalingEnabled, ok := s.D.GetOkExists("is_auto_scaling_enabled"); ok {
26562686
tmp := isAutoScalingEnabled.(bool)
26572687
details.IsAutoScalingEnabled = &tmp
@@ -2880,6 +2910,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
28802910
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
28812911
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
28822912
}
2913+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
2914+
tmp := inMemoryPercentage.(int)
2915+
details.InMemoryPercentage = &tmp
2916+
}
28832917
if isAutoScalingEnabled, ok := s.D.GetOkExists("is_auto_scaling_enabled"); ok {
28842918
tmp := isAutoScalingEnabled.(bool)
28852919
details.IsAutoScalingEnabled = &tmp
@@ -3101,6 +3135,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
31013135
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
31023136
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
31033137
}
3138+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
3139+
tmp := inMemoryPercentage.(int)
3140+
details.InMemoryPercentage = &tmp
3141+
}
31043142
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok {
31053143
tmp := isAccessControlEnabled.(bool)
31063144
details.IsAccessControlEnabled = &tmp
@@ -3309,6 +3347,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
33093347
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
33103348
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
33113349
}
3350+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
3351+
tmp := inMemoryPercentage.(int)
3352+
details.InMemoryPercentage = &tmp
3353+
}
33123354
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok {
33133355
tmp := isAccessControlEnabled.(bool)
33143356
details.IsAccessControlEnabled = &tmp
@@ -3528,6 +3570,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
35283570
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
35293571
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
35303572
}
3573+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
3574+
tmp := inMemoryPercentage.(int)
3575+
details.InMemoryPercentage = &tmp
3576+
}
35313577
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok {
35323578
tmp := isAccessControlEnabled.(bool)
35333579
details.IsAccessControlEnabled = &tmp
@@ -3751,6 +3797,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
37513797
if freeformTags, ok := s.D.GetOkExists("freeform_tags"); ok {
37523798
details.FreeformTags = tfresource.ObjectMapToStringMap(freeformTags.(map[string]interface{}))
37533799
}
3800+
if inMemoryPercentage, ok := s.D.GetOkExists("in_memory_percentage"); ok {
3801+
tmp := inMemoryPercentage.(int)
3802+
details.InMemoryPercentage = &tmp
3803+
}
37543804
if isAccessControlEnabled, ok := s.D.GetOkExists("is_access_control_enabled"); ok {
37553805
tmp := isAccessControlEnabled.(bool)
37563806
details.IsAccessControlEnabled = &tmp

0 commit comments

Comments
 (0)