Skip to content

Commit 19c025c

Browse files
committed
add Support resource discovery for oda resources
1 parent 4f0dbd9 commit 19c025c

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Support for Tags in Shared DB Home resource
88
- Support `oci_database_autonomous_vm_cluster` for service `database`
99
- Support for `mount_type_details`, `mount_type`, `nfs_server` and `nfs_server_export` attributes in `oci_database_backup_destination` resource
10+
- Support resource discovery for `ons` resources
1011

1112
### Notes
1213
- `mount_type_details` attribute needs to be set when `type` attribute is set to `NFS` in `oci_database_backup_destination` resource

oci/export_definitions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
oci_nosql "github.com/oracle/oci-go-sdk/nosql"
2929
oci_oce "github.com/oracle/oci-go-sdk/oce"
3030
oci_oda "github.com/oracle/oci-go-sdk/oda"
31+
oci_ons "github.com/oracle/oci-go-sdk/ons"
3132
oci_osmanagement "github.com/oracle/oci-go-sdk/osmanagement"
3233
oci_streaming "github.com/oracle/oci-go-sdk/streaming"
3334
oci_waas "github.com/oracle/oci-go-sdk/waas"
@@ -1262,6 +1263,16 @@ var exportObjectStoragePreauthenticatedRequestHints = &TerraformResourceHints{
12621263
resourceAbbreviation: "preauthenticated_request",
12631264
}
12641265

1266+
var exportOnsNotificationTopicHints = &TerraformResourceHints{
1267+
resourceClass: "oci_ons_notification_topic",
1268+
datasourceClass: "oci_ons_notification_topics",
1269+
datasourceItemsAttr: "notification_topics",
1270+
resourceAbbreviation: "notification_topic",
1271+
discoverableLifecycleStates: []string{
1272+
string(oci_ons.NotificationTopicLifecycleStateActive),
1273+
},
1274+
}
1275+
12651276
var exportOsmanagementManagedInstanceGroupHints = &TerraformResourceHints{
12661277
resourceClass: "oci_osmanagement_managed_instance_group",
12671278
datasourceClass: "oci_osmanagement_managed_instance_groups",

oci/export_graphs.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var compartmentResourceGraphs = map[string]TerraformResourceGraph{
7272
"object_storage": objectStorageResourceGraph,
7373
"oce": oceResourceGraph,
7474
"oda": odaResourceGraph,
75+
"ons": onsResourceGraph,
7576
"osmanagement": osmanagementResourceGraph,
7677
"streaming": streamingResourceGraph,
7778
"tagging": taggingResourceGraph,
@@ -648,6 +649,12 @@ var odaResourceGraph = TerraformResourceGraph{
648649
},
649650
}
650651

652+
var onsResourceGraph = TerraformResourceGraph{
653+
"oci_identity_compartment": {
654+
{TerraformResourceHints: exportOnsNotificationTopicHints},
655+
},
656+
}
657+
651658
var osmanagementResourceGraph = TerraformResourceGraph{
652659
"oci_identity_compartment": {
653660
{TerraformResourceHints: exportOsmanagementManagedInstanceGroupHints},

oci/export_resource_helpers.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ func init() {
338338
exportObjectStorageNamespaceHints.getHCLStringOverrideFn = getObjectStorageNamespaceHCLDatasource
339339
exportObjectStorageNamespaceHints.alwaysExportable = true
340340

341+
exportOnsNotificationTopicHints.getIdFn = getOnsNotificationTopicId
342+
341343
exportObjectStorageBucketHints.getIdFn = getObjectStorageBucketId
342344
exportObjectStorageObjectHints.getIdFn = getObjectStorageObjectId
343345
exportObjectStorageObjectHints.requireResourceRefresh = true
@@ -823,6 +825,14 @@ func processLoadBalancerCertificates(clients *OracleClients, resources []*OCIRes
823825
return resources, nil
824826
}
825827

828+
func getOnsNotificationTopicId(resource *OCIResource) (string, error) {
829+
id, ok := resource.sourceAttributes["topic_id"].(string)
830+
if !ok {
831+
return "", fmt.Errorf("[ERROR] unable to find topic id for ons notification topic")
832+
}
833+
return id, nil
834+
}
835+
826836
func getObjectStorageBucketId(resource *OCIResource) (string, error) {
827837
name, ok := resource.sourceAttributes["name"].(string)
828838
if !ok {

website/docs/guides/resource_discovery.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ The generated `.tf` files contain the Terraform configuration with the resources
119119
* `oce` - Discovers oce resources within the specified compartment
120120
* `object_storage` - Discovers object storage resources within the specified compartment
121121
* `oda` - Discovers oda resources within the specified compartment
122+
* `ons` - Discovers ons resources within the specified compartment
122123
* `osmanagement` - Discovers osmanagement resources within the specified compartment
123124
* `streaming` - Discovers streaming resources within the specified compartment
124125
* `tagging` - Discovers tag-related resources within the specified compartment
@@ -419,6 +420,10 @@ oda
419420

420421
* oci\_oda\_oda\_instance
421422

423+
ons
424+
425+
* oci\_ons\_notification\_topic
426+
422427
osmanagement
423428

424429
* oci\_osmanagement\_managed\_instance\_group

0 commit comments

Comments
 (0)