Skip to content

Commit 559d778

Browse files
Terraform Team Automationvarakali
authored andcommitted
Added - support for New Developer Autonomous databases.
1 parent 89e60fd commit 559d778

8 files changed

+95
-6
lines changed

examples/database/adb/autonomous_database.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ resource "oci_database_autonomous_database" "test_autonomous_database_ecpu" {
9090
is_free_tier = "false"
9191
}
9292

93+
resource "oci_database_autonomous_database" "test_autonomous_database_developer" {
94+
admin_password = random_string.autonomous_database_admin_password.result
95+
compartment_id = var.compartment_ocid
96+
compute_count = "4.0"
97+
compute_model = "ECPU"
98+
data_storage_size_in_gb = "20"
99+
db_name = "adbDeveloper"
100+
db_version = "19c"
101+
license_model = "LICENSE_INCLUDED"
102+
is_free_tier = "false"
103+
}
104+
93105
resource "oci_database_autonomous_database" "test_autonomous_database_local_adg_failover_data_loss_limit" {
94106
admin_password = random_string.autonomous_database_admin_password.result
95107
compartment_id = var.compartment_ocid

internal/integrationtest/database_autonomous_database_resource_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,6 +4423,64 @@ func TestDatabaseAutonomousDatabase_opsi_dbms(t *testing.T) {
44234423
})
44244424
}
44254425

4426+
func TestDatabaseAutonomousDatabaseResource_DeveloperDatabases(t *testing.T) {
4427+
httpreplay.SetScenario("TestDatabaseAutonomousDatabaseResource_scheduledOperations")
4428+
defer httpreplay.SaveScenario()
4429+
4430+
config := acctest.ProviderTestConfig()
4431+
4432+
compartmentId := utils.GetEnvSettingWithBlankDefault("compartment_ocid")
4433+
compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId)
4434+
4435+
okvSecret = utils.GetEnvSettingWithBlankDefault("okv_secret")
4436+
OkvSecretVariableStr = fmt.Sprintf("variable \"okv_secret\" { default = \"%s\" }\n", okvSecret)
4437+
4438+
resourceName := "oci_database_autonomous_database.test_autonomous_database"
4439+
// Save TF content to Create resource with optional properties. This has to be exactly the same as the config part in the "Create with optionals" step in the test.
4440+
acctest.SaveConfigContent(config+compartmentIdVariableStr+DatabaseAutonomousDatabaseResourceDependencies+
4441+
acctest.GenerateResourceFromRepresentationMap("oci_database_autonomous_database", "test_autonomous_database", acctest.Optional, acctest.Create, DatabaseAutonomousDatabaseRepresentation), "database", "autonomousDatabase", t)
4442+
4443+
acctest.ResourceTest(t, testAccCheckDatabaseAutonomousDatabaseDestroy, []resource.TestStep{
4444+
//0. Verify create Developer adb
4445+
{
4446+
Config: config + compartmentIdVariableStr + DatabaseAutonomousDatabaseResourceDependencies +
4447+
acctest.GenerateResourceFromRepresentationMap("oci_database_autonomous_database", "test_autonomous_database", acctest.Optional, acctest.Create, autonomousDatabaseRepresentationForDevTier),
4448+
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
4449+
resource.TestCheckResourceAttr(resourceName, "admin_password", "BEstrO0ng_#11"),
4450+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
4451+
resource.TestCheckResourceAttr(resourceName, "compute_count", "4"),
4452+
resource.TestCheckResourceAttr(resourceName, "db_name", adbName),
4453+
// verify computed field db_workload to be defaulted to OLTP
4454+
resource.TestCheckResourceAttr(resourceName, "db_workload", "OLTP"),
4455+
resource.TestCheckResourceAttr(resourceName, "is_dev_tier", "true"),
4456+
4457+
func(s *terraform.State) (err error) {
4458+
_, err = acctest.FromInstanceState(s, resourceName, "id")
4459+
return err
4460+
},
4461+
),
4462+
},
4463+
//1. upgrade from developer to paid
4464+
{
4465+
Config: config + compartmentIdVariableStr + DatabaseAutonomousDatabaseResourceDependencies +
4466+
acctest.GenerateResourceFromRepresentationMap("oci_database_autonomous_database", "test_autonomous_database", acctest.Optional, acctest.Update, autonomousDatabaseRepresentationForDevTier),
4467+
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
4468+
resource.TestCheckResourceAttr(resourceName, "admin_password", "BEstrO0ng_#11"),
4469+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
4470+
resource.TestCheckResourceAttr(resourceName, "compute_count", "4"),
4471+
resource.TestCheckResourceAttr(resourceName, "db_name", adbName),
4472+
// verify computed field db_workload to be defaulted to OLTP
4473+
resource.TestCheckResourceAttr(resourceName, "db_workload", "OLTP"),
4474+
resource.TestCheckResourceAttr(resourceName, "is_dev_tier", "false"),
4475+
func(s *terraform.State) (err error) {
4476+
_, err = acctest.FromInstanceState(s, resourceName, "id")
4477+
return err
4478+
},
4479+
),
4480+
},
4481+
})
4482+
}
4483+
44264484
func TestDatabaseAutonomousDatabaseResource_scheduledOperations(t *testing.T) {
44274485
httpreplay.SetScenario("TestDatabaseAutonomousDatabaseResource_scheduledOperations")
44284486
defer httpreplay.SaveScenario()

internal/integrationtest/database_autonomous_database_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,21 @@ var (
288288

289289
autonomousDatabaseRepresentationForScheduledOperations = acctest.RepresentationCopyWithNewProperties(DatabaseAutonomousDatabaseRepresentation, map[string]interface{}{})
290290

291+
DatabaseAutonomousDatabaseRepresentationDeveloper = map[string]interface{}{
292+
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
293+
"compute_count": acctest.Representation{RepType: acctest.Required, Create: `4`},
294+
"data_storage_size_in_gb": acctest.Representation{RepType: acctest.Required, Create: `20`},
295+
"compute_model": acctest.Representation{RepType: acctest.Required, Create: `ECPU`},
296+
"db_name": acctest.Representation{RepType: acctest.Required, Create: adbName},
297+
"admin_password": acctest.Representation{RepType: acctest.Required, Create: `BEstrO0ng_#11`},
298+
"db_version": acctest.Representation{RepType: acctest.Optional, Create: `${data.oci_database_autonomous_db_versions.test_autonomous_db_versions.autonomous_db_versions.0.version}`},
299+
"db_workload": acctest.Representation{RepType: acctest.Optional, Create: `OLTP`},
300+
"state": acctest.Representation{RepType: acctest.Optional, Create: `AVAILABLE`},
301+
}
302+
autonomousDatabaseRepresentationForDevTier = acctest.RepresentationCopyWithNewProperties(DatabaseAutonomousDatabaseRepresentationDeveloper, map[string]interface{}{
303+
"is_dev_tier": acctest.Representation{RepType: acctest.Optional, Create: `true`, Update: `false`},
304+
})
305+
291306
DatabaseAutonomousDatabaseResourceDependencies = DefinedTagsDependencies + KeyResourceDependencyConfigDbaas +
292307
acctest.GenerateDataSourceFromRepresentationMap("oci_database_autonomous_db_versions", "test_autonomous_db_versions", acctest.Required, acctest.Create, DatabaseDatabaseAutonomousDbVersionDataSourceRepresentation) +
293308
acctest.GenerateDataSourceFromRepresentationMap("oci_database_autonomous_db_versions", "test_autonomous_dw_versions", acctest.Required, acctest.Create,

internal/service/database/database_autonomous_database_resource.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) Update() error {
17381738
request.IsDataGuardEnabled = &tmp
17391739
}
17401740

1741-
if isDevTier, ok := s.D.GetOkExists("is_dev_tier"); ok {
1741+
if isDevTier, ok := s.D.GetOkExists("is_dev_tier"); ok && s.D.HasChange("is_dev_tier") {
17421742
tmp := isDevTier.(bool)
17431743
request.IsDevTier = &tmp
17441744
}
@@ -4091,6 +4091,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
40914091
tmp := isDedicated.(bool)
40924092
details.IsDedicated = &tmp
40934093
}
4094+
if isDevTier, ok := s.D.GetOkExists("is_dev_tier"); ok {
4095+
tmp := isDevTier.(bool)
4096+
details.IsDevTier = &tmp
4097+
}
40944098
if isFreeTier, ok := s.D.GetOkExists("is_free_tier"); ok {
40954099
tmp := isFreeTier.(bool)
40964100
details.IsFreeTier = &tmp

website/docs/d/database_autonomous_database.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ The following attributes are exported:
124124
* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
125125
* `is_data_guard_enabled` - **Deprecated.** Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure.
126126
* `is_dedicated` - True if the database uses [dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html).
127-
* `is_dev_tier` - This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled
127+
* `is_dev_tier` - Autonomous Database for Developers are fixed-shape Autonomous Databases that developers can use to build and test new applications. On Serverless, these are low-cost and billed per instance, on Dedicated and Cloud@Customer there is no additional cost to create Developer databases. Developer databases come with limited resources and is not intended for large-scale testing and production deployments. When you need more compute or storage resources, you may upgrade to a full paid production database.
128128
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
129129

130130
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isLocalDataGuardEnabled

website/docs/d/database_autonomous_databases.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ The following attributes are exported:
157157
* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
158158
* `is_data_guard_enabled` - **Deprecated.** Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure.
159159
* `is_dedicated` - True if the database uses [dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html).
160-
* `is_dev_tier` - This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled
160+
* `is_dev_tier` - Autonomous Database for Developers are fixed-shape Autonomous Databases that developers can use to build and test new applications. On Serverless, these are low-cost and billed per instance, on Dedicated and Cloud@Customer there is no additional cost to create Developer databases. Developer databases come with limited resources and is not intended for large-scale testing and production deployments. When you need more compute or storage resources, you may upgrade to a full paid production database.
161161
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
162162

163163
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isLocalDataGuardEnabled

website/docs/d/database_autonomous_databases_clones.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ The following attributes are exported:
141141
* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
142142
* `is_data_guard_enabled` - **Deprecated.** Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure.
143143
* `is_dedicated` - True if the database uses [dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html).
144-
* `is_dev_tier` - This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled
144+
* `is_dev_tier` - Autonomous Database for Developers are fixed-shape Autonomous Databases that developers can use to build and test new applications. On Serverless, these are low-cost and billed per instance, on Dedicated and Cloud@Customer there is no additional cost to create Developer databases. Developer databases come with limited resources and is not intended for large-scale testing and production deployments. When you need more compute or storage resources, you may upgrade to a full paid production database.
145145
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
146146

147147
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isLocalDataGuardEnabled

website/docs/r/database_autonomous_database.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ The following arguments are supported:
185185
* `is_auto_scaling_for_storage_enabled` - (Optional) (Updatable) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
186186
* `is_data_guard_enabled` - (Optional) (Updatable) **Deprecated.** Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure.
187187
* `is_dedicated` - (Optional) True if the database is on [dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html).
188-
* `is_dev_tier` - (Optional) (Updatable) This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled
188+
* `is_dev_tier` - (Optional) (Updatable) Autonomous Database for Developers are fixed-shape Autonomous Databases that developers can use to build and test new applications. On Serverless, these are low-cost and billed per instance, on Dedicated and Cloud@Customer there is no additional cost to create Developer databases. Developer databases come with limited resources and is not intended for large-scale testing and production deployments. When you need more compute or storage resources, you may upgrade to a full paid production database.
189189
* `is_free_tier` - (Optional) (Updatable) Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
190190

191191
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isLocalDataGuardEnabled When `db_workload` is `AJD` it cannot be `true`.
@@ -387,7 +387,7 @@ The following attributes are exported:
387387
* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
388388
* `is_data_guard_enabled` - **Deprecated.** Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure.
389389
* `is_dedicated` - True if the database uses [dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html).
390-
* `is_dev_tier` - This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled
390+
* `is_dev_tier` - Autonomous Database for Developers are fixed-shape Autonomous Databases that developers can use to build and test new applications. On Serverless, these are low-cost and billed per instance, on Dedicated and Cloud@Customer there is no additional cost to create Developer databases. Developer databases come with limited resources and is not intended for large-scale testing and production deployments. When you need more compute or storage resources, you may upgrade to a full paid production database.
391391
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
392392

393393
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isLocalDataGuardEnabled

0 commit comments

Comments
 (0)