Skip to content

Commit f83d66b

Browse files
Terraform Team AutomationNagendraNigade
authored andcommitted
Added - adding examples for ADG and CADG, fixing is_dataguard_enabled appearing twice
1 parent 483146a commit f83d66b

File tree

4 files changed

+124
-11
lines changed

4 files changed

+124
-11
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
resource "random_string" "autonomous_database_admin_password" {
5+
length = 16
6+
min_numeric = 1
7+
min_lower = 1
8+
min_upper = 1
9+
min_special = 1
10+
}
11+
resource "time_sleep" "wait_300_seconds" {
12+
destroy_duration = "5m"
13+
depends_on = [oci_database_autonomous_database.autonomous_database_cross_region_dataguard_primary]
14+
}
15+
16+
resource "oci_database_autonomous_database" "autonomous_database_cross_region_dataguard_primary" {
17+
admin_password = random_string.autonomous_database_admin_password.result
18+
compartment_id = var.compartment_id
19+
cpu_core_count = "1"
20+
data_storage_size_in_tbs = "1"
21+
db_name = "adbdb11ff2"
22+
db_version = "19c"
23+
license_model = "LICENSE_INCLUDED"
24+
is_free_tier = "false"
25+
}
26+
27+
resource "oci_database_autonomous_database" "autonomous_database_cross_region_dataguard_standby" {
28+
#Note: this should be provisioned in another region as the source database.
29+
provider = oci.peer_region
30+
31+
#Required for cross-region standby
32+
compartment_id = var.compartment_id
33+
source = "CROSS_REGION_DATAGUARD"
34+
source_id = oci_database_autonomous_database.autonomous_database_cross_region_dataguard_primary.id
35+
db_name = oci_database_autonomous_database.autonomous_database_cross_region_dataguard_primary.db_name
36+
}
37+
38+
data "oci_database_autonomous_databases" "autonomous_databases" {
39+
filter {
40+
name = "id"
41+
values = [oci_database_autonomous_database.autonomous_database_cross_region_dataguard_standby.id]
42+
}
43+
44+
filter {
45+
name = "peer_db_ids"
46+
values = [oci_database_autonomous_database.autonomous_database_cross_region_dataguard_primary.id]
47+
}
48+
49+
filter {
50+
name = "role"
51+
values = ["STANDBY"]
52+
}
53+
54+
#Required
55+
compartment_id = var.compartment_id
56+
57+
#Optional
58+
display_name = oci_database_autonomous_database.autonomous_database_cross_region_dataguard_standby.display_name
59+
}
60+
61+
output "autonomous_databases" {
62+
value = data.oci_database_autonomous_databases.autonomous_databases.autonomous_databases
63+
}
64+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {
5+
}
6+
7+
variable "user_ocid" {
8+
}
9+
10+
variable "fingerprint" {
11+
}
12+
13+
variable "private_key_path" {
14+
}
15+
16+
variable "region" {
17+
default = "us-phoenix-1"
18+
}
19+
20+
variable "peer_region" {
21+
default = "us-ashburn-1"
22+
}
23+
24+
variable "compartment_id" {
25+
}
26+
27+
provider "oci" {
28+
region = var.region
29+
tenancy_ocid = var.tenancy_ocid
30+
user_ocid = var.user_ocid
31+
fingerprint = var.fingerprint
32+
private_key_path = var.private_key_path
33+
}
34+
35+
provider "oci" {
36+
alias = "peer_region"
37+
region = var.peer_region
38+
tenancy_ocid = var.tenancy_ocid
39+
user_ocid = var.user_ocid
40+
fingerprint = var.fingerprint
41+
private_key_path = var.private_key_path
42+
}

website/docs/r/database_autonomous_database.html.markdown

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: "oci"
44
page_title: "Oracle Cloud Infrastructure: oci_database_autonomous_database"
55
sidebar_current: "docs-oci-resource-database-autonomous_database"
66
description: |-
7-
Provides the Autonomous Database resource in Oracle Cloud Infrastructure Database service
7+
Provides the Autonomous Database resource in Oracle Cloud Infrastructure Database service
88
---
99

1010
# oci_database_autonomous_database
@@ -110,8 +110,12 @@ The following arguments are supported:
110110
* `compute_count` - (Optional) (Updatable) The compute amount available to the database. Minimum and maximum values depend on the compute model and whether the database is on Shared or Dedicated infrastructure. For an Autonomous Database on Shared infrastructure, the 'ECPU' compute model requires values in multiples of two. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value.
111111
* `compute_model` - (Optional) The compute model of the Autonomous Database. This is required if using the `computeCount` parameter. If using `cpuCoreCount` then it is an error to specify `computeModel` to a non-null value.
112112
* `cpu_core_count` - (Optional) (Updatable) The number of OCPU cores to be made available to the database. For Autonomous Databases on dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details.
113-
114-
**Note:** This parameter cannot be used with the `ocpuCount` parameter. This input is ignored for Always Free resources.
113+
**Note:** This parameter cannot be used with the `ocpuCount` parameter.
114+
* The data type must be an *integer*.
115+
* The minimum number of cores for all types of autonomous database is *1*
116+
* The maximum number of cores is as follows:
117+
* Autonomous Databases on shared Exadata infrastructure: The maximum number of cores is *128*.
118+
* Autonomous Databases on dedicated Exadata infrastructure: The maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details.
115119
* `customer_contacts` - (Optional) (Updatable) Customer Contacts.
116120
* `email` - (Optional) (Updatable) The email address used by Oracle to send notifications regarding databases and infrastructure.
117121
* `data_safe_status` - (Optional) (Updatable) Status of the Data Safe registration for this Autonomous Database. Could be REGISTERED or NOT_REGISTERED.
@@ -124,7 +128,7 @@ The following arguments are supported:
124128

125129
**Note:** This parameter cannot be used with the `dataStorageSizeInGBs` parameter. This input is ignored for Always Free resources.
126130
* `database_edition` - (Optional) (Updatable) The Oracle Database Edition that applies to the Autonomous databases.
127-
* `db_name` - (Required) The database name. The name must begin with an alphabetic character and can contain a maximum of 14 alphanumeric characters. Special characters are not permitted. The database name must be unique in the tenancy.
131+
* `db_name` - (Required) (Updatable) The database name. The name must begin with an alphabetic character and can contain a maximum of 14 alphanumeric characters. Special characters are not permitted. The database name must be unique in the tenancy.
128132
* `db_version` - (Optional) (Updatable) A valid Oracle Database version for Autonomous Database.`db_workload` AJD and APEX are only supported for `db_version` `19c` and above.
129133
* `db_workload` - (Optional) (Updatable) The Autonomous Database workload type. The following values are valid:
130134
* OLTP - indicates an Autonomous Transaction Processing database
@@ -140,7 +144,6 @@ The following arguments are supported:
140144
* `is_auto_scaling_enabled` - (Optional) (Updatable) Indicates if auto scaling is enabled for the Autonomous Database OCPU core count. The default value is `FALSE`.
141145
* `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.
142146
* `is_local_data_guard_enabled` - (Optional) (Updatable) 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.
143-
* `is_data_guard_enabled` - (Optional) (Updatable) 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.
144147
* `is_auto_scaling_for_storage_enabled` - (Optional) (Updatable) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`.
145148
* `is_dedicated` - (Optional) True if the database is on [dedicated Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adbddoverview.htm).
146149
* `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. When `db_workload` is `AJD` or `APEX` it cannot be `true`.
@@ -256,9 +259,14 @@ The following attributes are exported:
256259
* `mongo_db_url` - The URL of the MongoDB API for the Autonomous Database.
257260
* `ords_url` - The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous Database.
258261
* `sql_dev_web_url` - Oracle SQL Developer Web URL.
259-
* `cpu_core_count` - The number of OCPU cores to be made available to the database. When the ECPU is selected, the value for cpuCoreCount is 0. For Autonomous Databases on dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details.
260-
261-
**Note:** This parameter cannot be used with the `ocpuCount` parameter.
262+
* `cpu_core_count` - The number of OCPU cores to be made available to the database.
263+
264+
**Note:** This parameter cannot be used with the `ocpuCount` parameter.
265+
* The data type must be an *integer*.
266+
* The minimum number of cores for all types of autonomous database is *1*
267+
* The maximum number of cores is as follows:
268+
* Autonomous Databases on shared Exadata infrastructure: The maximum number of cores is *128*.
269+
* Autonomous Databases on dedicated Exadata infrastructure: The maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details.
262270
* `customer_contacts` - Customer Contacts.
263271
* `email` - The email address used by Oracle to send notifications regarding databases and infrastructure.
264272
* `data_safe_status` - Status of the Data Safe registration for this Autonomous Database. Could be REGISTERED or NOT_REGISTERED.
@@ -342,7 +350,7 @@ The following attributes are exported:
342350
* `scheduled_start_time` - auto start time. value must be of ISO-8601 format "HH:mm"
343351
* `scheduled_stop_time` - auto stop time. value must be of ISO-8601 format "HH:mm"
344352
* `service_console_url` - The URL of the Service Console for the Autonomous Database.
345-
* `source_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the source Autonomous Database that was cloned to create the current Autonomous Database.
353+
* `source_id` - (Required when source=CLONE_TO_REFRESHABLE | CROSS_REGION_DATAGUARD | DATABASE) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the source Autonomous Database that will be used to create a new standby database for the Data Guard association.
346354
* `standby_db` - **Deprecated** Autonomous Data Guard standby database details.
347355
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
348356
* `lifecycle_details` - Additional information about the current lifecycle state.
@@ -385,7 +393,6 @@ The following attributes are exported:
385393
For shared Exadata infrastructure, this is an array of CIDR (Classless Inter-Domain Routing) notations for a subnet or VCN OCID. Use a semicolon (;) as a deliminator between the VCN-specific subnets or IPs. Example: `["1.1.1.1","1.1.1.0/24","ocid1.vcn.oc1.sea.<unique_id>","ocid1.vcn.oc1.sea.<unique_id1>;1.1.1.1","ocid1.vcn.oc1.sea.<unique_id2>;1.1.0.0/16"]` For Exadata Cloud@Customer, this is an array of IP addresses or CIDR (Classless Inter-Domain Routing) notations. Example: `["1.1.1.1","1.1.1.0/24","1.1.2.25"]`
386394

387395
For an update operation, if you want to delete all the IPs in the ACL, use an array with a single empty string entry.
388-
389396
## Timeouts
390397

391398
The `timeouts` block allows you to specify [timeouts](https://registry.terraform.io/providers/oracle/oci/latest/docs/guides/changing_timeouts) for certain operations:

website/docs/r/database_cloud_autonomous_vm_cluster.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: "oci"
44
page_title: "Oracle Cloud Infrastructure: oci_database_cloud_autonomous_vm_cluster"
55
sidebar_current: "docs-oci-resource-database-cloud_autonomous_vm_cluster"
66
description: |-
7-
Provides the Cloud Autonomous Vm Cluster resource in Oracle Cloud Infrastructure Database service
7+
Provides the Cloud Autonomous Vm Cluster resource in Oracle Cloud Infrastructure Database service
88
---
99

1010
# oci_database_cloud_autonomous_vm_cluster

0 commit comments

Comments
 (0)