|
| 1 | +// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// Licensed under the Mozilla Public License v2.0 |
| 3 | + |
| 4 | +variable "tenancy_ocid" {} |
| 5 | +variable "user_ocid" {} |
| 6 | +variable "fingerprint" {} |
| 7 | +variable "private_key_path" {} |
| 8 | +variable "region" {} |
| 9 | + |
| 10 | +variable "monitor_configuration_config_type" { |
| 11 | + default = "BROWSER_CONFIG" |
| 12 | +} |
| 13 | + |
| 14 | +variable "monitor_configuration_is_certificate_validation_enabled" { |
| 15 | + default = false |
| 16 | +} |
| 17 | + |
| 18 | +variable "monitor_configuration_is_failure_retried" { |
| 19 | + default = false |
| 20 | +} |
| 21 | + |
| 22 | +variable "monitor_configuration_is_redirection_enabled" { |
| 23 | + default = false |
| 24 | +} |
| 25 | + |
| 26 | +variable "monitor_configuration_req_authentication_details_auth_headers_header_name" { |
| 27 | + default = "headerName" |
| 28 | +} |
| 29 | + |
| 30 | +variable "monitor_configuration_req_authentication_details_auth_headers_header_value" { |
| 31 | + default = "headerValue" |
| 32 | +} |
| 33 | + |
| 34 | +variable "monitor_configuration_req_authentication_details_auth_request_method" { |
| 35 | + default = "GET" |
| 36 | +} |
| 37 | + |
| 38 | +variable "monitor_configuration_req_authentication_details_auth_request_post_body" { |
| 39 | + default = "authRequestPostBody" |
| 40 | +} |
| 41 | + |
| 42 | +variable "monitor_configuration_req_authentication_details_auth_token" { |
| 43 | + default = "authToken" |
| 44 | +} |
| 45 | + |
| 46 | +variable "monitor_configuration_req_authentication_details_auth_url" { |
| 47 | + default = "authUrl" |
| 48 | +} |
| 49 | + |
| 50 | +variable "monitor_configuration_req_authentication_details_auth_user_password" { |
| 51 | + default = "authUserPassword" |
| 52 | +} |
| 53 | + |
| 54 | +variable "monitor_configuration_req_authentication_details_oauth_scheme" { |
| 55 | + default = "NONE" |
| 56 | +} |
| 57 | + |
| 58 | +variable "monitor_configuration_req_authentication_scheme" { |
| 59 | + default = "OAUTH" |
| 60 | +} |
| 61 | + |
| 62 | +variable "monitor_configuration_request_headers_header_name" { |
| 63 | + default = "headerName" |
| 64 | +} |
| 65 | + |
| 66 | +variable "monitor_configuration_request_headers_header_value" { |
| 67 | + default = "headerValue" |
| 68 | +} |
| 69 | + |
| 70 | +variable "monitor_configuration_request_method" { |
| 71 | + default = "GET" |
| 72 | +} |
| 73 | + |
| 74 | +variable "monitor_configuration_request_post_body" { |
| 75 | + default = "requestPostBody" |
| 76 | +} |
| 77 | + |
| 78 | +variable "monitor_configuration_request_query_params_param_name" { |
| 79 | + default = "paramName" |
| 80 | +} |
| 81 | + |
| 82 | +variable "monitor_configuration_request_query_params_param_value" { |
| 83 | + default = "paramValue" |
| 84 | +} |
| 85 | + |
| 86 | +variable "monitor_configuration_verify_response_codes" { |
| 87 | + default = [] |
| 88 | +} |
| 89 | + |
| 90 | +variable "monitor_configuration_verify_response_content" { |
| 91 | + default = "verifyResponseContent" |
| 92 | +} |
| 93 | + |
| 94 | +variable "monitor_configuration_verify_texts_text" { |
| 95 | + default = "text" |
| 96 | +} |
| 97 | + |
| 98 | +variable "monitor_defined_tags_value" { |
| 99 | + default = "value" |
| 100 | +} |
| 101 | + |
| 102 | +variable "monitor_display_name" { |
| 103 | + default = "displayName" |
| 104 | +} |
| 105 | + |
| 106 | +variable "monitor_freeform_tags" { |
| 107 | + default = { "bar-key" = "value" } |
| 108 | +} |
| 109 | + |
| 110 | +variable "monitor_monitor_type" { |
| 111 | + default = "SCRIPTED_BROWSER" |
| 112 | +} |
| 113 | + |
| 114 | +variable "monitor_repeat_interval_in_seconds" { |
| 115 | + default = 600 |
| 116 | +} |
| 117 | + |
| 118 | +variable "monitor_script_parameters_param_name" { |
| 119 | + default = "paramName" |
| 120 | +} |
| 121 | + |
| 122 | +variable "monitor_script_parameters_param_value" { |
| 123 | + default = "paramValue" |
| 124 | +} |
| 125 | + |
| 126 | +variable "monitor_status" { |
| 127 | + default = "ENABLED" |
| 128 | +} |
| 129 | + |
| 130 | +variable "monitor_target" { |
| 131 | + default = "target" |
| 132 | +} |
| 133 | + |
| 134 | +variable "monitor_timeout_in_seconds" { |
| 135 | + default = 60 |
| 136 | +} |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | +provider "oci" { |
| 141 | + tenancy_ocid = var.tenancy_ocid |
| 142 | + user_ocid = var.user_ocid |
| 143 | + fingerprint = var.fingerprint |
| 144 | + private_key_path = var.private_key_path |
| 145 | + region = var.region |
| 146 | +} |
| 147 | + |
| 148 | +resource "oci_apm_synthetics_monitor" "test_monitor" { |
| 149 | + #Required |
| 150 | + apm_domain_id = oci_apm_apm_domain.test_apm_domain.id |
| 151 | + display_name = var.monitor_display_name |
| 152 | + monitor_type = var.monitor_monitor_type |
| 153 | + repeat_interval_in_seconds = var.monitor_repeat_interval_in_seconds |
| 154 | + vantage_points { |
| 155 | + } |
| 156 | + |
| 157 | + #Optional |
| 158 | + configuration { |
| 159 | + |
| 160 | + #Optional |
| 161 | + config_type = var.monitor_configuration_config_type |
| 162 | + is_certificate_validation_enabled = var.monitor_configuration_is_certificate_validation_enabled |
| 163 | + is_failure_retried = var.monitor_configuration_is_failure_retried |
| 164 | + is_redirection_enabled = var.monitor_configuration_is_redirection_enabled |
| 165 | + req_authentication_details { |
| 166 | + |
| 167 | + #Optional |
| 168 | + auth_headers { |
| 169 | + |
| 170 | + #Optional |
| 171 | + header_name = var.monitor_configuration_req_authentication_details_auth_headers_header_name |
| 172 | + header_value = var.monitor_configuration_req_authentication_details_auth_headers_header_value |
| 173 | + } |
| 174 | + auth_request_method = var.monitor_configuration_req_authentication_details_auth_request_method |
| 175 | + auth_request_post_body = var.monitor_configuration_req_authentication_details_auth_request_post_body |
| 176 | + auth_token = var.monitor_configuration_req_authentication_details_auth_token |
| 177 | + auth_url = var.monitor_configuration_req_authentication_details_auth_url |
| 178 | + auth_user_name = oci_identity_user.test_user.name |
| 179 | + auth_user_password = var.monitor_configuration_req_authentication_details_auth_user_password |
| 180 | + oauth_scheme = var.monitor_configuration_req_authentication_details_oauth_scheme |
| 181 | + } |
| 182 | + req_authentication_scheme = var.monitor_configuration_req_authentication_scheme |
| 183 | + request_headers { |
| 184 | + |
| 185 | + #Optional |
| 186 | + header_name = var.monitor_configuration_request_headers_header_name |
| 187 | + header_value = var.monitor_configuration_request_headers_header_value |
| 188 | + } |
| 189 | + request_method = var.monitor_configuration_request_method |
| 190 | + request_post_body = var.monitor_configuration_request_post_body |
| 191 | + request_query_params { |
| 192 | + |
| 193 | + #Optional |
| 194 | + param_name = var.monitor_configuration_request_query_params_param_name |
| 195 | + param_value = var.monitor_configuration_request_query_params_param_value |
| 196 | + } |
| 197 | + verify_response_codes = var.monitor_configuration_verify_response_codes |
| 198 | + verify_response_content = var.monitor_configuration_verify_response_content |
| 199 | + verify_texts { |
| 200 | + |
| 201 | + #Optional |
| 202 | + text = var.monitor_configuration_verify_texts_text |
| 203 | + } |
| 204 | + } |
| 205 | + defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.monitor_defined_tags_value) |
| 206 | + freeform_tags = var.monitor_freeform_tags |
| 207 | + script_id = oci_apm_synthetics_script.test_script.id |
| 208 | + script_parameters { |
| 209 | + #Required |
| 210 | + param_name = var.monitor_script_parameters_param_name |
| 211 | + param_value = var.monitor_script_parameters_param_value |
| 212 | + } |
| 213 | + status = var.monitor_status |
| 214 | + target = var.monitor_target |
| 215 | + timeout_in_seconds = var.monitor_timeout_in_seconds |
| 216 | +} |
| 217 | + |
| 218 | +data "oci_apm_synthetics_monitors" "test_monitors" { |
| 219 | + #Required |
| 220 | + apm_domain_id = oci_apm_apm_domain.test_apm_domain.id |
| 221 | + |
| 222 | + #Optional |
| 223 | + display_name = var.monitor_display_name |
| 224 | + monitor_type = var.monitor_monitor_type |
| 225 | + script_id = oci_apm_synthetics_script.test_script.id |
| 226 | + status = var.monitor_status |
| 227 | +} |
| 228 | + |
0 commit comments