Skip to content

Commit e796037

Browse files
author
Yi Fan
committed
Support resource discovery for functions resources
1 parent 5f483f6 commit e796037

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Support resource discovery for limits resources
55
- Support for Online resize (grow) of block volume
66
- Support Terraform v0.12 syntax for resource discovery. Default is now v0.12 for generated configurations.
7+
- Support resource discovery for functions resources
78

89
### Fixed
910
- Add missing attributes for `oci_file_storage_mount_target` import [Github issue #1037](https://github.com/terraform-providers/terraform-provider-oci/issues/1037)

oci/export_definitions.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
oci_bds "github.com/oracle/oci-go-sdk/bds"
55
oci_core "github.com/oracle/oci-go-sdk/core"
66
oci_database "github.com/oracle/oci-go-sdk/database"
7+
oci_functions "github.com/oracle/oci-go-sdk/functions"
78
oci_identity "github.com/oracle/oci-go-sdk/identity"
89
oci_limits "github.com/oracle/oci-go-sdk/limits"
910
oci_load_balancer "github.com/oracle/oci-go-sdk/loadbalancer"
@@ -351,6 +352,28 @@ var exportDatabaseDbSystemHints = &TerraformResourceHints{
351352
},
352353
}
353354

355+
var exportFunctionsApplicationHints = &TerraformResourceHints{
356+
resourceClass: "oci_functions_application",
357+
datasourceClass: "oci_functions_applications",
358+
datasourceItemsAttr: "applications",
359+
resourceAbbreviation: "application",
360+
requireResourceRefresh: true,
361+
discoverableLifecycleStates: []string{
362+
string(oci_functions.ApplicationLifecycleStateActive),
363+
},
364+
}
365+
366+
var exportFunctionsFunctionHints = &TerraformResourceHints{
367+
resourceClass: "oci_functions_function",
368+
datasourceClass: "oci_functions_functions",
369+
datasourceItemsAttr: "functions",
370+
resourceAbbreviation: "function",
371+
requireResourceRefresh: true,
372+
discoverableLifecycleStates: []string{
373+
string(oci_functions.FunctionLifecycleStateActive),
374+
},
375+
}
376+
354377
var exportIdentityApiKeyHints = &TerraformResourceHints{
355378
resourceClass: "oci_identity_api_key",
356379
datasourceClass: "oci_identity_api_keys",

oci/export_graphs.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var compartmentResourceGraphs = map[string]TerraformResourceGraph{
2626
"bds": bdsResourceGraph,
2727
"core": coreResourceGraph,
2828
"database": databaseResourceGraph,
29+
"functions": functionsResourceGraph,
2930
"load_balancer": loadBalancerResourceGraph,
3031
"object_storage": objectStorageResourceGraph,
3132
"tagging": taggingResourceGraph,
@@ -154,6 +155,20 @@ var databaseResourceGraph = TerraformResourceGraph{
154155
},
155156
}
156157

158+
var functionsResourceGraph = TerraformResourceGraph{
159+
"oci_identity_compartment": {
160+
{TerraformResourceHints: exportFunctionsApplicationHints},
161+
},
162+
"oci_functions_application": {
163+
{
164+
TerraformResourceHints: exportFunctionsFunctionHints,
165+
datasourceQueryParams: map[string]string{
166+
"application_id": "id",
167+
},
168+
},
169+
},
170+
}
171+
157172
var identityResourceGraph = TerraformResourceGraph{
158173
"oci_identity_tenancy": {
159174
{TerraformResourceHints: exportIdentityAuthenticationPolicyHints},

website/docs/guides/resource_discovery.html.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ The generated `.tf` files contain the Terraform configuration with the resources
9292
* `bds` - Discovers big data service resources within the specified compartment
9393
* `core` - Discovers compute, block storage, and networking resources within the specified compartment
9494
* `database` - Discovers database resources within the specified compartment
95+
* `functions` - Discovers functions resources within the specified compartment
9596
* `identity` - Discovers identity resources across the entire tenancy
9697
* `limits` - Discovers limits resources across the entire tenancy
9798
* `load_balancer` - Discovers load balancer resources within the specified compartment
@@ -215,6 +216,11 @@ database
215216
* oci\_database\_db\_home
216217
* oci\_database\_db\_system
217218

219+
functions
220+
221+
* oci\_functions\_application
222+
* oci\_functions\_function
223+
218224
identity
219225

220226
* oci\_identity\_api\_key

0 commit comments

Comments
 (0)