|
| 1 | +// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | + |
| 3 | +variable "tenancy_ocid" {} |
| 4 | +variable "user_ocid" {} |
| 5 | +variable "fingerprint" {} |
| 6 | +variable "private_key_path" {} |
| 7 | +variable "region" {} |
| 8 | +variable "compartment_id" {} |
| 9 | + |
| 10 | +provider "oci" { |
| 11 | + tenancy_ocid = "${var.tenancy_ocid}" |
| 12 | + user_ocid = "${var.user_ocid}" |
| 13 | + fingerprint = "${var.fingerprint}" |
| 14 | + private_key_path = "${var.private_key_path}" |
| 15 | + region = "${var.region}" |
| 16 | +} |
| 17 | + |
| 18 | +resource "oci_events_rule" "test_rule" { |
| 19 | + #Required |
| 20 | + actions { |
| 21 | + #Required |
| 22 | + actions { |
| 23 | + #Required |
| 24 | + action_type = "ONS" |
| 25 | + is_enabled = true |
| 26 | + |
| 27 | + #Optional |
| 28 | + description = "description" |
| 29 | + topic_id = "${oci_ons_notification_topic.test_notification_topic.id}" |
| 30 | + } |
| 31 | + |
| 32 | + actions { |
| 33 | + #Required |
| 34 | + action_type = "OSS" |
| 35 | + is_enabled = true |
| 36 | + |
| 37 | + #Optional |
| 38 | + description = "description" |
| 39 | + stream_id = "${oci_streaming_stream.test_stream.id}" |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + compartment_id = "${var.compartment_id}" |
| 44 | + condition = "{\"eventType\": \"com.oraclecloud.dbaas.autonomous.database.backup.end\"}" |
| 45 | + display_name = "This rule sends a notification upon completion of DbaaS backup" |
| 46 | + is_enabled = true |
| 47 | +} |
| 48 | + |
| 49 | +data "oci_events_rules" "test_rules" { |
| 50 | + #Required |
| 51 | + compartment_id = "${var.compartment_id}" |
| 52 | + |
| 53 | + #Optional |
| 54 | + display_name = "This rule sends a notification upon completion of DbaaS backup" |
| 55 | + state = "ACTIVE" |
| 56 | +} |
| 57 | + |
| 58 | +resource "oci_streaming_stream" "test_stream" { |
| 59 | + compartment_id = "${var.tenancy_ocid}" |
| 60 | + name = "testStream" |
| 61 | + partitions = "1" |
| 62 | + retention_in_hours = "24" |
| 63 | +} |
| 64 | + |
| 65 | +resource "oci_ons_notification_topic" "test_notification_topic" { |
| 66 | + #Required |
| 67 | + compartment_id = "${var.compartment_id}" |
| 68 | + name = "testNotificationTopic" |
| 69 | +} |
0 commit comments