@@ -13,6 +13,8 @@ import (
1313 "github.com/oracle/terraform-provider-baremetal/objectstorage"
1414 "github.com/hashicorp/terraform/helper/schema"
1515 "github.com/hashicorp/terraform/terraform"
16+ "os"
17+ "strconv"
1618)
1719
1820var descriptions map [string ]string
@@ -27,11 +29,15 @@ func init() {
2729 "private_key_path" : "(Optional) The path to the user's PEM formatted private key.\n " +
2830 "A private_key or a private_key_path must be provided." ,
2931 "private_key_password" : "(Optional) The password used to secure the private key." ,
32+ "timeout_minutes" : "(Optional) The minimum API timeout for requests" ,
3033 }
3134}
3235
3336// Provider is the adapter for terraform, that gives access to all the resources
3437func Provider (configfn schema.ConfigureFunc ) terraform.ResourceProvider {
38+ if os .Getenv ("TF_ORACLE_ENV" ) == "test" && os .Getenv ("TF_VAR_timeout_minutes" ) == "" {
39+ os .Setenv ("TF_VAR_timeout_minutes" , "5" ) // This is for testing, it is overwritten correctly in ConfigureFunc when not in testmode
40+ }
3541 return & schema.Provider {
3642 DataSourcesMap : dataSourcesMap (),
3743 Schema : schemaMap (),
@@ -65,6 +71,12 @@ func schemaMap() map[string]*schema.Schema {
6571 Sensitive : true ,
6672 Description : descriptions ["private_key" ],
6773 },
74+ "timeout_minutes" : {
75+ Type : schema .TypeInt ,
76+ Optional : true ,
77+ Default : 5 ,
78+ Description : descriptions ["timeout_minutes" ],
79+ },
6880 "private_key_path" : {
6981 Type : schema .TypeString ,
7082 Optional : true ,
@@ -167,6 +179,8 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
167179 privateKeyBuffer , hasKey := d .Get ("private_key" ).(string )
168180 privateKeyPath , hasKeyPath := d .Get ("private_key_path" ).(string )
169181 privateKeyPassword , hasKeyPass := d .Get ("private_key_password" ).(string )
182+ defaultTimeout := d .Get ("timeout_minutes" ).(int )
183+ os .Setenv ("TF_VAR_timeout_minutes" , strconv .Itoa (defaultTimeout ))
170184
171185 clientOpts := []baremetal.NewClientOptionsFunc {
172186 func (o * baremetal.NewClientOptions ) {
0 commit comments