Skip to content

Commit 81d4eb8

Browse files
committed
adding option to disable automatic retries as a short term soln. for issue #179
1 parent 00d87df commit 81d4eb8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/examples/compute/single_instance/provider.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ provider "baremetal" {
33
user_ocid = "${var.user_ocid}"
44
fingerprint = "${var.fingerprint}"
55
private_key_path = "${var.private_key_path}"
6+
disable_auto_retries = "true"
67
}

provider.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func init() {
2828
"A private_key or a private_key_path must be provided.",
2929
"private_key_password": "(Optional) The password used to secure the private key.",
3030
"region": "(Optional) The region for API connections.",
31+
"disable_auto_retries": "(Optional) Disable Automatic retries for retriable errors.\n" +
32+
"Auto retries were introduced to solve some eventual consistency problems but it also introduced performance issues on destroy operations.",
3133
}
3234
}
3335

@@ -91,6 +93,13 @@ func schemaMap() map[string]*schema.Schema {
9193
Description: descriptions["region"],
9294
DefaultFunc: schema.EnvDefaultFunc("OBMCS_REGION", nil),
9395
},
96+
"disable_auto_retries": {
97+
Type: schema.TypeBool,
98+
Optional: true,
99+
Default: false,
100+
Description: descriptions["disable_auto_retries"],
101+
DefaultFunc: schema.EnvDefaultFunc("OBMCS_DISABLE_AUTO_RETRIES", nil),
102+
},
94103
}
95104
}
96105

@@ -219,6 +228,7 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
219228
privateKeyPath, hasKeyPath := d.Get("private_key_path").(string)
220229
privateKeyPassword, hasKeyPass := d.Get("private_key_password").(string)
221230
region, hasRegion := d.Get("region").(string)
231+
disableAutoRetries, hasDisableRetries := d.Get("disable_auto_retries").(bool)
222232

223233
// for internal use
224234
urlTemplate := getEnvSetting("url_template", "")
@@ -258,6 +268,10 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
258268
clientOpts = append(clientOpts, baremetal.Region(region))
259269
}
260270

271+
if hasDisableRetries {
272+
clientOpts = append(clientOpts, baremetal.DisableAutoRetries(disableAutoRetries))
273+
}
274+
261275
if urlTemplate != "" {
262276
clientOpts = append(clientOpts, baremetal.UrlTemplate(urlTemplate))
263277
}

0 commit comments

Comments
 (0)