1
1
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2
2
// Licensed under the Mozilla Public License v2.0
3
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
- }
18
-
19
- variable "compartment_id" {
20
- }
21
-
22
4
provider "oci" {
23
5
region = var. region
24
6
tenancy_ocid = var. tenancy_ocid
@@ -27,30 +9,17 @@ provider "oci" {
27
9
private_key_path = var. private_key_path
28
10
}
29
11
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" {
44
13
# 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
48
15
49
- is_retired = false
50
- }
16
+ # Optional
17
+ db_workload = var . autonomous_database_db_workload
51
18
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
+ }
54
23
}
55
24
56
25
data "oci_database_autonomous_db_versions" "test_autonomous_dw_versions" {
@@ -66,66 +35,70 @@ resource "oci_database_autonomous_database" "test_autonomous_database_source" {
66
35
db_name = " rcB8w9HgKux1t1"
67
36
db_version = " 19c"
68
37
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"
84
41
}
85
42
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" {
88
44
compartment_id = var. compartment_id
45
+ db_name = " bjfjkXw4ZutTt2"
89
46
cpu_core_count = " 1"
90
47
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 "
104
61
is_dedicated = " false"
105
- is_preview_version_with_service_terms_accepted = " false"
106
62
is_refreshable_clone = " true"
107
63
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" ))
109
68
source = " CLONE_TO_REFRESHABLE"
110
69
source_id = oci_database_autonomous_database. test_autonomous_database_source . id
111
-
112
- whitelisted_ips = [" 1.1.1.1/28" ]
113
70
}
114
71
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
117
74
}
118
75
119
- data "oci_database_autonomous_databases" "oci_database_autonomous_databases " {
76
+ data "oci_database_autonomous_databases" "oci_database_autonomous_databases_manual " {
120
77
compartment_id = var. compartment_id
121
78
122
79
filter {
123
80
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 ]
125
82
}
126
83
}
127
84
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
+ }
130
100
}
131
101
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