|
| 1 | +// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + |
| 3 | +/* |
| 4 | + * Provider config for dns sample |
| 5 | + */ |
| 6 | + |
| 7 | +variable "http_monitor_display_name" { |
| 8 | + default = "displayName" |
| 9 | +} |
| 10 | + |
| 11 | +variable "http_monitor_freeform_tags" { |
| 12 | + default = { |
| 13 | + "Department" = "Finance" |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +variable "http_monitor_headers" { |
| 18 | + default = "headers" |
| 19 | +} |
| 20 | + |
| 21 | +variable "http_monitor_interval_in_seconds" { |
| 22 | + default = 10 |
| 23 | +} |
| 24 | + |
| 25 | +variable "http_monitor_is_enabled" { |
| 26 | + default = true |
| 27 | +} |
| 28 | + |
| 29 | +variable "http_monitor_method" { |
| 30 | + default = "GET" |
| 31 | +} |
| 32 | + |
| 33 | +variable "http_monitor_path" { |
| 34 | + default = "/" |
| 35 | +} |
| 36 | + |
| 37 | +variable "http_monitor_port" { |
| 38 | + default = "443" |
| 39 | +} |
| 40 | + |
| 41 | +variable "http_monitor_protocol" { |
| 42 | + default = "HTTPS" |
| 43 | +} |
| 44 | + |
| 45 | +variable "http_monitor_targets" { |
| 46 | + default = ["www.oracle.com"] |
| 47 | +} |
| 48 | + |
| 49 | +variable "http_monitor_timeout_in_seconds" { |
| 50 | + default = 10 |
| 51 | +} |
| 52 | + |
| 53 | +variable "http_monitor_vantage_point_names" { |
| 54 | + default = ["goo-chs"] |
| 55 | +} |
| 56 | + |
| 57 | +variable "steering_policy_answers_is_disabled" { |
| 58 | + default = false |
| 59 | +} |
| 60 | + |
| 61 | +variable "steering_policy_answers_name" { |
| 62 | + default = "name" |
| 63 | +} |
| 64 | + |
| 65 | +variable "steering_policy_answers_pool" { |
| 66 | + default = "pool" |
| 67 | +} |
| 68 | + |
| 69 | +variable "steering_policy_answers_rdata" { |
| 70 | + default = "192.0.2.1" |
| 71 | +} |
| 72 | + |
| 73 | +variable "steering_policy_answers_rtype" { |
| 74 | + default = "A" |
| 75 | +} |
| 76 | + |
| 77 | +variable "steering_policy_display_name" { |
| 78 | + default = "displayName" |
| 79 | +} |
| 80 | + |
| 81 | +variable "steering_policy_display_name_contains" { |
| 82 | + default = "displayNameContains" |
| 83 | +} |
| 84 | + |
| 85 | +variable "steering_policy_freeform_tags" { |
| 86 | + default = { |
| 87 | + "bar-key" = "value" |
| 88 | + } |
| 89 | +} |
| 90 | + |
| 91 | +variable "steering_policy_id" { |
| 92 | + default = "id" |
| 93 | +} |
| 94 | + |
| 95 | +variable "steering_policy_rules_cases_answer_data_answer_condition" { |
| 96 | + default = "answer.name == 'sampler'" |
| 97 | +} |
| 98 | + |
| 99 | +variable "steering_policy_rules_cases_answer_data_should_keep" { |
| 100 | + default = false |
| 101 | +} |
| 102 | + |
| 103 | +variable "steering_policy_rules_cases_answer_data_value" { |
| 104 | + default = 10 |
| 105 | +} |
| 106 | + |
| 107 | +variable "steering_policy_rules_cases_case_condition" { |
| 108 | + default = "query.client.address in (subnet '198.51.100.0/24')" |
| 109 | +} |
| 110 | + |
| 111 | +variable "steering_policy_rules_cases_count" { |
| 112 | + default = 10 |
| 113 | +} |
| 114 | + |
| 115 | +variable "steering_policy_rules_default_answer_data_answer_condition" { |
| 116 | + default = "answer.name == 'sampler'" |
| 117 | +} |
| 118 | + |
| 119 | +variable "steering_policy_rules_default_answer_data_should_keep" { |
| 120 | + default = false |
| 121 | +} |
| 122 | + |
| 123 | +variable "steering_policy_rules_default_answer_data_value" { |
| 124 | + default = 10 |
| 125 | +} |
| 126 | + |
| 127 | +variable "steering_policy_rules_default_count" { |
| 128 | + default = 10 |
| 129 | +} |
| 130 | + |
| 131 | +variable "steering_policy_rules_rule_type" { |
| 132 | + default = "PRIORITY" |
| 133 | +} |
| 134 | + |
| 135 | +variable "steering_policy_state" { |
| 136 | + default = "ACTIVE" |
| 137 | +} |
| 138 | + |
| 139 | +variable "steering_policy_template" { |
| 140 | + default = "CUSTOM" |
| 141 | +} |
| 142 | + |
| 143 | +variable "steering_policy_time_created_greater_than_or_equal_to" { |
| 144 | + default = "2018-01-01T00:00:00.000Z" |
| 145 | +} |
| 146 | + |
| 147 | +variable "steering_policy_time_created_less_than" { |
| 148 | + default = "2038-01-01T00:00:00.000Z" |
| 149 | +} |
| 150 | + |
| 151 | +variable "steering_policy_ttl" { |
| 152 | + default = 10 |
| 153 | +} |
| 154 | + |
| 155 | +resource "oci_health_checks_http_monitor" "test_http_monitor" { |
| 156 | + #Required |
| 157 | + compartment_id = "${var.compartment_ocid}" |
| 158 | + display_name = "${var.http_monitor_display_name}" |
| 159 | + interval_in_seconds = "${var.http_monitor_interval_in_seconds}" |
| 160 | + protocol = "${var.http_monitor_protocol}" |
| 161 | + targets = "${var.http_monitor_targets}" |
| 162 | + |
| 163 | + #Optional |
| 164 | + freeform_tags = "${var.http_monitor_freeform_tags}" |
| 165 | + is_enabled = "${var.http_monitor_is_enabled}" |
| 166 | + method = "${var.http_monitor_method}" |
| 167 | + path = "${var.http_monitor_path}" |
| 168 | + port = "${var.http_monitor_port}" |
| 169 | + timeout_in_seconds = "${var.http_monitor_timeout_in_seconds}" |
| 170 | + vantage_point_names = "${var.http_monitor_vantage_point_names}" |
| 171 | +} |
| 172 | + |
| 173 | +resource "oci_dns_steering_policy" "test_steering_policy" { |
| 174 | + #Required |
| 175 | + compartment_id = "${var.compartment_ocid}" |
| 176 | + display_name = "${var.steering_policy_display_name}" |
| 177 | + template = "${var.steering_policy_template}" |
| 178 | + |
| 179 | + #Optional |
| 180 | + answers { |
| 181 | + #Required |
| 182 | + name = "${var.steering_policy_answers_name}" |
| 183 | + rdata = "${var.steering_policy_answers_rdata}" |
| 184 | + rtype = "${var.steering_policy_answers_rtype}" |
| 185 | + |
| 186 | + #Optional |
| 187 | + is_disabled = "${var.steering_policy_answers_is_disabled}" |
| 188 | + pool = "${var.steering_policy_answers_pool}" |
| 189 | + } |
| 190 | + |
| 191 | + freeform_tags = "${var.steering_policy_freeform_tags}" |
| 192 | + health_check_monitor_id = "${oci_health_checks_http_monitor.test_http_monitor.id}" |
| 193 | + |
| 194 | + rules { |
| 195 | + #Required |
| 196 | + rule_type = "FILTER" |
| 197 | + |
| 198 | + #Optional |
| 199 | + cases { |
| 200 | + #Optional |
| 201 | + answer_data { |
| 202 | + #Optional |
| 203 | + answer_condition = "${var.steering_policy_rules_cases_answer_data_answer_condition}" |
| 204 | + should_keep = "${var.steering_policy_rules_cases_answer_data_should_keep}" |
| 205 | + } |
| 206 | + |
| 207 | + case_condition = "${var.steering_policy_rules_cases_case_condition}" |
| 208 | + } |
| 209 | + |
| 210 | + default_answer_data { |
| 211 | + #Optional |
| 212 | + answer_condition = "${var.steering_policy_rules_default_answer_data_answer_condition}" |
| 213 | + should_keep = "${var.steering_policy_rules_default_answer_data_should_keep}" |
| 214 | + } |
| 215 | + } |
| 216 | + |
| 217 | + rules { |
| 218 | + #Required |
| 219 | + rule_type = "HEALTH" |
| 220 | + |
| 221 | + #Optional |
| 222 | + cases { |
| 223 | + #Optional |
| 224 | + case_condition = "${var.steering_policy_rules_cases_case_condition}" |
| 225 | + } |
| 226 | + } |
| 227 | + |
| 228 | + rules { |
| 229 | + #Required |
| 230 | + rule_type = "LIMIT" |
| 231 | + |
| 232 | + #Optional |
| 233 | + cases { |
| 234 | + case_condition = "${var.steering_policy_rules_cases_case_condition}" |
| 235 | + count = "${var.steering_policy_rules_cases_count}" |
| 236 | + } |
| 237 | + |
| 238 | + default_count = "${var.steering_policy_rules_default_count}" |
| 239 | + } |
| 240 | + |
| 241 | + rules { |
| 242 | + #Required |
| 243 | + rule_type = "PRIORITY" |
| 244 | + |
| 245 | + #Optional |
| 246 | + cases { |
| 247 | + #Optional |
| 248 | + answer_data { |
| 249 | + #Optional |
| 250 | + answer_condition = "${var.steering_policy_rules_cases_answer_data_answer_condition}" |
| 251 | + value = "${var.steering_policy_rules_cases_answer_data_value}" |
| 252 | + } |
| 253 | + |
| 254 | + case_condition = "${var.steering_policy_rules_cases_case_condition}" |
| 255 | + } |
| 256 | + |
| 257 | + default_answer_data { |
| 258 | + #Optional |
| 259 | + answer_condition = "${var.steering_policy_rules_default_answer_data_answer_condition}" |
| 260 | + value = "${var.steering_policy_rules_default_answer_data_value}" |
| 261 | + } |
| 262 | + } |
| 263 | + |
| 264 | + rules { |
| 265 | + #Required |
| 266 | + rule_type = "${var.steering_policy_rules_rule_type}" |
| 267 | + |
| 268 | + #Optional |
| 269 | + cases { |
| 270 | + #Optional |
| 271 | + answer_data { |
| 272 | + #Optional |
| 273 | + answer_condition = "${var.steering_policy_rules_cases_answer_data_answer_condition}" |
| 274 | + value = "${var.steering_policy_rules_cases_answer_data_value}" |
| 275 | + } |
| 276 | + |
| 277 | + case_condition = "${var.steering_policy_rules_cases_case_condition}" |
| 278 | + } |
| 279 | + |
| 280 | + default_answer_data { |
| 281 | + #Optional |
| 282 | + answer_condition = "${var.steering_policy_rules_default_answer_data_answer_condition}" |
| 283 | + value = "${var.steering_policy_rules_default_answer_data_value}" |
| 284 | + } |
| 285 | + } |
| 286 | + |
| 287 | + ttl = "${var.steering_policy_ttl}" |
| 288 | +} |
| 289 | + |
| 290 | +data "oci_dns_steering_policies" "test_steering_policies" { |
| 291 | + #Required |
| 292 | + compartment_id = "${var.compartment_ocid}" |
| 293 | + |
| 294 | + #Optional |
| 295 | + display_name = "${var.steering_policy_display_name}" |
| 296 | + |
| 297 | + #display_name_contains = "${var.steering_policy_display_name_contains}" |
| 298 | + health_check_monitor_id = "${oci_health_checks_http_monitor.test_http_monitor.id}" |
| 299 | + id = "${oci_dns_steering_policy.test_steering_policy.id}" |
| 300 | + state = "${var.steering_policy_state}" |
| 301 | + template = "${var.steering_policy_template}" |
| 302 | + time_created_greater_than_or_equal_to = "${var.steering_policy_time_created_greater_than_or_equal_to}" |
| 303 | + time_created_less_than = "${var.steering_policy_time_created_less_than}" |
| 304 | +} |
0 commit comments