11// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
22// Licensed under the Mozilla Public License v2.0
33
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- }
18-
19- variable "compartment_id" {
20- }
21-
224provider "oci" {
235 region = var. region
246 tenancy_ocid = var. tenancy_ocid
@@ -27,30 +9,17 @@ provider "oci" {
279 private_key_path = var. private_key_path
2810}
2911
30- variable "defined_tag_namespace_name" {
31- default = " "
32- }
33-
34- resource "oci_identity_tag_namespace" "tag-namespace1" {
35- # Required
36- compartment_id = var. tenancy_ocid
37- description = " example tag namespace"
38- name = var. defined_tag_namespace_name != " " ? var. defined_tag_namespace_name : " example-tag-namespace-all"
39-
40- is_retired = false
41- }
42-
43- resource "oci_identity_tag" "tag1" {
12+ data "oci_database_autonomous_db_versions" "test_autonomous_db_versions" {
4413 # Required
45- description = " example tag"
46- name = " example-tag"
47- tag_namespace_id = oci_identity_tag_namespace. tag-namespace1 . id
14+ compartment_id = var. compartment_id
4815
49- is_retired = false
50- }
16+ # Optional
17+ db_workload = var . autonomous_database_db_workload
5118
52- data "oci_database_autonomous_db_versions" "test_autonomous_db_versions" {
53- compartment_id = var. compartment_id
19+ filter {
20+ name = " version"
21+ values = [" 19c" ]
22+ }
5423}
5524
5625data "oci_database_autonomous_db_versions" "test_autonomous_dw_versions" {
@@ -66,66 +35,70 @@ resource "oci_database_autonomous_database" "test_autonomous_database_source" {
6635 db_name = " rcB8w9HgKux1t1"
6736 db_version = " 19c"
6837 db_workload = " OLTP"
69- defined_tags = {
70- " ${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = " value"
71- }
72- display_name = " regular_source"
73-
74- freeform_tags = {
75- " Department" = " Finance"
76- }
77-
78- is_auto_scaling_enabled = " false"
79- is_dedicated = " false"
80- is_preview_version_with_service_terms_accepted = " false"
81- license_model = " LICENSE_INCLUDED"
82-
83- whitelisted_ips = [" 1.1.1.1/28" ]
38+ display_name = " regular_source"
39+ is_dedicated = " false"
40+ license_model = " LICENSE_INCLUDED"
8441}
8542
86- resource "oci_database_autonomous_database" "test_autonomous_database_refreshable_clone" {
87- admin_password = " "
43+ resource "oci_database_autonomous_database" "test_autonomous_database_refreshable_clone_manual" {
8844 compartment_id = var. compartment_id
45+ db_name = " bjfjkXw4ZutTt2"
8946 cpu_core_count = " 1"
9047 data_storage_size_in_tbs = " 1"
91- db_name = " bjfjkXw4ZutTt2 "
92- db_version = " 19c "
93- db_workload = " OLTP "
94- defined_tags = {
95- " ${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name} " = " value "
96- }
97- display_name = " refreshable_clone "
98-
99- freeform_tags = {
100- " Department " = " Finance "
101- }
102-
103- is_auto_scaling_enabled = " false "
48+ is_dedicated = " false "
49+ is_refreshable_clone = " true "
50+ license_model = " LICENSE_INCLUDED "
51+ refreshable_mode = " MANUAL "
52+ source = " CLONE_TO_REFRESHABLE "
53+ source_id = oci_database_autonomous_database . test_autonomous_database_source . id
54+ }
55+
56+ resource "oci_database_autonomous_database" "test_autonomous_database_refreshable_clone_automatic" {
57+ compartment_id = var . compartment_id
58+ db_name = " bjfjkXw4ZutTt3 "
59+ cpu_core_count = " 1 "
60+ data_storage_size_in_tbs = " 1 "
10461 is_dedicated = " false"
105- is_preview_version_with_service_terms_accepted = " false"
10662 is_refreshable_clone = " true"
10763 license_model = " LICENSE_INCLUDED"
108- refreshable_mode = " MANUAL"
64+ refreshable_mode = " AUTOMATIC"
65+ auto_refresh_point_lag_in_seconds = " 5000"
66+ auto_refresh_frequency_in_seconds = " 6000"
67+ time_of_auto_refresh_start = formatdate (" YYYY-MM-DD'T'hh:mm:ss'.000'Z" , timeadd (timestamp (), " 24h" ))
10968 source = " CLONE_TO_REFRESHABLE"
11069 source_id = oci_database_autonomous_database. test_autonomous_database_source . id
111-
112- whitelisted_ips = [" 1.1.1.1/28" ]
11370}
11471
115- data "oci_database_autonomous_database" "oci_database_autonomous_database " {
116- autonomous_database_id = oci_database_autonomous_database. test_autonomous_database_refreshable_clone . id
72+ data "oci_database_autonomous_database" "oci_database_autonomous_database_manual " {
73+ autonomous_database_id = oci_database_autonomous_database. test_autonomous_database_refreshable_clone_manual . id
11774}
11875
119- data "oci_database_autonomous_databases" "oci_database_autonomous_databases " {
76+ data "oci_database_autonomous_databases" "oci_database_autonomous_databases_manual " {
12077 compartment_id = var. compartment_id
12178
12279 filter {
12380 name = " id"
124- values = [oci_database_autonomous_database . test_autonomous_database_refreshable_clone . id ]
81+ values = [oci_database_autonomous_database . test_autonomous_database_refreshable_clone_manual . id ]
12582 }
12683}
12784
128- output "autonomous_database_refreshable_clone" {
129- value = data. oci_database_autonomous_databases . oci_database_autonomous_databases . autonomous_databases
85+ output "autonomous_database_refreshable_clone_manual" {
86+ value = data. oci_database_autonomous_databases . oci_database_autonomous_databases_manual . autonomous_databases
87+ }
88+
89+ data "oci_database_autonomous_database" "oci_database_autonomous_database_automatic" {
90+ autonomous_database_id = oci_database_autonomous_database. test_autonomous_database_refreshable_clone_automatic . id
91+ }
92+
93+ data "oci_database_autonomous_databases" "oci_database_autonomous_databases_automatic" {
94+ compartment_id = var. compartment_id
95+
96+ filter {
97+ name = " id"
98+ values = [oci_database_autonomous_database . test_autonomous_database_refreshable_clone_automatic . id ]
99+ }
130100}
131101
102+ output "autonomous_database_refreshable_clone_automatic" {
103+ value = data. oci_database_autonomous_databases . oci_database_autonomous_databases_automatic . autonomous_databases
104+ }
0 commit comments