Skip to content

Commit d0e5277

Browse files
Terraform Team Automationravinitp
authored andcommitted
Added - Stack Monitoring: Extensibility Support
1 parent c39e724 commit d0e5277

File tree

32 files changed

+3514
-168
lines changed

32 files changed

+3514
-168
lines changed

examples/stack_monitoring/monitored_resource_associate_monitored_resources/monitored_resource_associate_monitored_resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ resource "oci_stack_monitoring_monitored_resource" "test_monitored_resource2" {
7878

7979
resource "oci_stack_monitoring_monitored_resources_associate_monitored_resource" "test_monitored_resources_associate_monitored_resource" {
8080
#Required
81-
association_type = "contains"
81+
association_type = "uses"
8282
compartment_id = var.compartment_ocid
8383
destination_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource2.id
8484
source_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource1.id
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) 2017, 2023, 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+
variable "compartment_ocid" {}
10+
variable "task_name" {}
11+
12+
13+
14+
provider "oci" {
15+
tenancy_ocid = var.tenancy_ocid
16+
user_ocid = var.user_ocid
17+
fingerprint = var.fingerprint
18+
private_key_path = var.private_key_path
19+
region = var.region
20+
}
21+
22+
resource "oci_stack_monitoring_monitored_resource_task" "test_monitored_resource_task" {
23+
#Required
24+
compartment_id = var.compartment_ocid
25+
name = var.task_name
26+
task_details {
27+
namespace = "oci_terraform_namespace"
28+
type = "IMPORT_OCI_TELEMETRY_RESOURCES"
29+
source = "OCI_TELEMETRY_NATIVE"
30+
}
31+
32+
#Optional
33+
freeform_tags = { "bar-key" = "test_monitored_resource_task.value" }
34+
lifecycle {
35+
ignore_changes = [
36+
freeform_tags, defined_tags, system_tags
37+
]
38+
39+
}
40+
}
41+
42+
data "oci_stack_monitoring_monitored_resource_tasks" "test_monitored_resource_tasks" {
43+
#Required
44+
compartment_id = oci_stack_monitoring_monitored_resource_task.test_monitored_resource_task.compartment_id
45+
#Optional
46+
status= "SUCCEEDED"
47+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2017, 2023, 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+
variable "compartment_ocid" {}
10+
11+
12+
provider "oci" {
13+
tenancy_ocid = var.tenancy_ocid
14+
user_ocid = var.user_ocid
15+
fingerprint = var.fingerprint
16+
private_key_path = var.private_key_path
17+
region = var.region
18+
}
19+
20+
resource "oci_stack_monitoring_monitored_resource_type" "test_monitored_resource_type" {
21+
#Required
22+
compartment_id = var.compartment_ocid
23+
name = "terraformResourceTypeExample"
24+
25+
#Optional
26+
description = "This is a resource type created for terraform test"
27+
display_name = "Terraform Resource Type Example"
28+
metric_namespace = "oci_terraform_test"
29+
freeform_tags = { "bar-key" = "test_monitored_resource_type.value" }
30+
metadata {
31+
format = "SYSTEM_FORMAT"
32+
agent_properties = [ "agent_prop1", "agent_prop2"]
33+
required_properties = [ "required_prop1", "required_prop2"]
34+
valid_properties_for_create = [ "valid_prop1", "valid_prop2"]
35+
valid_properties_for_update = ["valid_prop2"]
36+
37+
}
38+
lifecycle {
39+
ignore_changes = [
40+
freeform_tags, defined_tags, system_tags, compartment_id,
41+
]
42+
43+
}
44+
}
45+
46+
data "oci_stack_monitoring_monitored_resource_types" "test_monitored_resource_types" {
47+
#Required
48+
compartment_id = oci_stack_monitoring_monitored_resource_type.test_monitored_resource_type.compartment_id
49+
#Optional
50+
name = oci_stack_monitoring_monitored_resource_type.test_monitored_resource_type.name
51+
status= "ACTIVE"
52+
}

examples/stack_monitoring/monitored_resources/monitored_resource.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,10 @@ data "oci_stack_monitoring_monitored_resource" "test_monitored_resource" {
5151
#Required
5252
monitored_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource.id
5353
}
54+
55+
data "oci_stack_monitoring_monitored_resources" "test_monitored_resources" {
56+
#Required
57+
compartment_id = oci_stack_monitoring_monitored_resource.test_monitored_resource.compartment_id
58+
#Optional
59+
name = oci_stack_monitoring_monitored_resource.test_monitored_resource.name
60+
}

examples/stack_monitoring/monitored_resources_list_members/monitored_resources_list_member.tf

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,93 +7,23 @@ variable "fingerprint" {}
77
variable "private_key_path" {}
88
variable "region" {}
99
variable "compartment_ocid" {}
10-
variable "stack_mon_management_agent_id_resource1" {}
11-
variable "stack_mon_management_agent_id_resource2" {}
12-
variable "stack_mon_hostname_resource1" {}
13-
variable "stack_mon_hostname_resource2" {}
10+
variable "stack_mon_source_resource_id" {}
11+
variable "stack_mon_destination_resource_id" {}
1412

1513

1614
provider "oci" {
17-
tenancy_ocid = var.tenancy_ocid
18-
user_ocid = var.user_ocid
19-
fingerprint = var.fingerprint
20-
private_key_path = var.private_key_path
21-
region = var.region
15+
tenancy_ocid = var.tenancy_ocid
16+
user_ocid = var.user_ocid
17+
fingerprint = var.fingerprint
18+
private_key_path = var.private_key_path
19+
region = var.region
2220
}
2321

24-
resource "oci_stack_monitoring_monitored_resource" "test_monitored_resource1" {
25-
#Required
26-
compartment_id = var.compartment_ocid
27-
name = "terraformExample"
28-
type = "host"
2922

30-
#Optional
31-
display_name = "exampleDisplayName"
32-
host_name = var.stack_mon_hostname_resource1
33-
management_agent_id = var.stack_mon_management_agent_id_resource1
34-
properties {
35-
name = "osName"
36-
value = "Linux"
37-
}
38-
properties {
39-
name = "osVersion"
40-
value = "7.0"
41-
}
42-
resource_time_zone = "en"
43-
freeform_tags = { "bar-key" = "test_monitored_resource1.value" }
44-
lifecycle {
45-
ignore_changes = [
46-
credentials,
47-
properties,
48-
external_id,
49-
defined_tags]
50-
}
51-
}
52-
resource "oci_stack_monitoring_monitored_resource" "test_monitored_resource2" {
23+
resource "oci_stack_monitoring_monitored_resources_list_member" "test_monitored_resources_list_member" {
5324
#Required
54-
compartment_id = var.compartment_ocid
55-
name = "terraformExample2"
56-
type = "host"
25+
monitored_resource_id = var.stack_mon_source_resource_id
5726

5827
#Optional
59-
display_name = "exampleDisplayName2"
60-
host_name = var.stack_mon_hostname_resource2
61-
management_agent_id = var.stack_mon_management_agent_id_resource2
62-
properties {
63-
name = "osName"
64-
value = "Linux"
65-
}
66-
properties {
67-
name = "osVersion"
68-
value = "7.0"
69-
}
70-
resource_time_zone = "en"
71-
freeform_tags = { "bar-key" = "test_monitored_resource2.value" }
72-
lifecycle {
73-
ignore_changes = [
74-
credentials,
75-
properties,
76-
external_id,
77-
defined_tags]
78-
}
79-
}
80-
81-
resource "oci_stack_monitoring_monitored_resources_associate_monitored_resource" "test_monitored_resources_associate_monitored_resource" {
82-
#Required
83-
association_type = "contains"
84-
compartment_id = var.compartment_ocid
85-
destination_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource2.id
86-
source_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource1.id
87-
lifecycle {
88-
ignore_changes = [
89-
id]
90-
}
91-
}
92-
93-
resource "oci_stack_monitoring_monitored_resources_list_member" "test_monitored_resources_list_member" {
94-
#Required
95-
monitored_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource1.id
96-
97-
#Optional
98-
destination_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource2.id
99-
}
28+
destination_resource_id = var.stack_mon_destination_resource_id
29+
}

examples/stack_monitoring/monitored_resources_search_associations/monitored_resources_search_association.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ resource "oci_stack_monitoring_monitored_resource" "test_monitored_resource2" {
8080

8181
resource "oci_stack_monitoring_monitored_resources_associate_monitored_resource" "test_monitored_resources_associate_monitored_resource" {
8282
#Required
83-
association_type = "contains"
83+
association_type = "uses"
8484
compartment_id = var.compartment_ocid
8585
destination_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource2.id
8686
source_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource1.id
@@ -95,7 +95,7 @@ resource "oci_stack_monitoring_monitored_resources_search_association" "test_mon
9595
compartment_id = var.compartment_ocid
9696

9797
#Optional
98-
association_type = "contains"
98+
association_type = "uses"
9999
destination_resource_id = oci_stack_monitoring_monitored_resource.test_monitored_resource2.id
100100
destination_resource_name = "terraformExample2"
101101
destination_resource_type = "host"

0 commit comments

Comments
 (0)