Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/Writing Terraform configurations for OBMCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ provider "baremetal" {
private_key_path = "${var.private_key_path}"
}
```

To specify a different region, include the region parameter in your provider definition. Not specifying a value will use the default `us-phoenix-1` region.
```
provider "baremetal" {
...
region = "us-ashburn-1"
}
```

## CamelCase
The OBMCS API uses CamelCase in multiple places. Terraform doesn't support CamelCase in configuration files so we've replaced it with underscores. For example -

Expand Down
3 changes: 3 additions & 0 deletions docs/resources/core/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ The following attributes are exported:
* `region` - The region that contains the Availability Domain the instance is running in.
* `shape` - The shape of the instance. The shape determines the number of CPUs and the amount of memory allocated to the instance.
* `time_created` - The date and time the instance was created.

* `public_ip` - The public ip of instance vnic (if enabled).
* `private_ip` - The private ip of instance vnic (if enabled).
13 changes: 13 additions & 0 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func init() {
"private_key_path": "(Optional) The path to the user's PEM formatted private key.\n" +
"A private_key or a private_key_path must be provided.",
"private_key_password": "(Optional) The password used to secure the private key.",
"region": "(Optional) The region for API connections.",
}
}

Expand Down Expand Up @@ -80,6 +81,13 @@ func schemaMap() map[string]*schema.Schema {
Description: descriptions["private_key_password"],
DefaultFunc: schema.EnvDefaultFunc("OBMCS_PRIVATE_KEY_PASSWORD", nil),
},
"region": {
Type: schema.TypeString,
Optional: true,
Default: "us-phoenix-1",
Description: descriptions["region"],
DefaultFunc: schema.EnvDefaultFunc("OBMCS_REGION", nil),
},
}
}

Expand Down Expand Up @@ -183,6 +191,7 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
privateKeyBuffer, hasKey := d.Get("private_key").(string)
privateKeyPath, hasKeyPath := d.Get("private_key_path").(string)
privateKeyPassword, hasKeyPass := d.Get("private_key_password").(string)
region, hasRegion := d.Get("region").(string)

clientOpts := []baremetal.NewClientOptionsFunc{
func(o *baremetal.NewClientOptions) {
Expand All @@ -206,6 +215,10 @@ func providerConfig(d *schema.ResourceData) (client interface{}, err error) {
clientOpts = append(clientOpts, baremetal.PrivateKeyPassword(privateKeyPassword))
}

if hasRegion && region != "" {
clientOpts = append(clientOpts, baremetal.Region(region))
}

client, err = baremetal.NewClient(userOCID, tenancyOCID, fingerprint, clientOpts...)
return
}
38 changes: 22 additions & 16 deletions vendor/github.com/MustWin/baremetal-sdk-go/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 11 additions & 35 deletions vendor/github.com/MustWin/baremetal-sdk-go/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions vendor/github.com/MustWin/baremetal-sdk-go/constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions vendor/github.com/MustWin/baremetal-sdk-go/request.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion vendor/github.com/MustWin/baremetal-sdk-go/requestor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/MustWin/baremetal-sdk-go/response.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading