[clc] additional server types + docs

This commit is contained in:
Albert Choi 2016-05-06 10:52:37 -07:00
parent 8ab63c2d52
commit 94a7c69153
2 changed files with 90 additions and 12 deletions

View File

@ -87,6 +87,20 @@ func resourceCLCServer() *schema.Resource {
Optional: true,
Default: "standard",
},
"aa_policy_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
// optional fields for bareMetal
"configuration_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"os_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
// sorta computed
"password": &schema.Schema{
@ -129,17 +143,18 @@ func resourceCLCServer() *schema.Resource {
func resourceCLCServerCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clc.Client)
spec := server.Server{
Name: d.Get("name_template").(string),
Password: d.Get("password").(string),
Description: d.Get("description").(string),
GroupID: d.Get("group_id").(string),
CPU: d.Get("cpu").(int),
MemoryGB: d.Get("memory_mb").(int) / 1024,
SourceServerID: d.Get("source_server_id").(string),
Type: d.Get("type").(string),
IPaddress: d.Get("private_ip_address").(string),
NetworkID: d.Get("network_id").(string),
Storagetype: d.Get("storage_type").(string),
Name: d.Get("name_template").(string),
Password: d.Get("password").(string),
Description: d.Get("description").(string),
GroupID: d.Get("group_id").(string),
CPU: d.Get("cpu").(int),
MemoryGB: d.Get("memory_mb").(int) / 1024,
SourceServerID: d.Get("source_server_id").(string),
Type: d.Get("type").(string),
IPaddress: d.Get("private_ip_address").(string),
NetworkID: d.Get("network_id").(string),
Storagetype: d.Get("storage_type").(string),
AntiAffinityPolicyID: d.Get("aa_policy_id").(string),
}
var err error
@ -160,6 +175,16 @@ func resourceCLCServerCreate(d *schema.ResourceData, meta interface{}) error {
}
spec.Packages = pkgs
if spec.Type == "bareMetal" {
// additional bareMetal fields
if conf_id := d.Get("configuration_id").(string); conf_id != "" {
spec.ConfigurationID = conf_id
}
if os_type := d.Get("os_type").(string); os_type != "" {
spec.OSType = os_type
}
}
resp, err := client.Server.Create(spec)
if err != nil || !resp.IsQueued {
return fmt.Errorf("Failed creating server: %v", err)

View File

@ -10,7 +10,12 @@ description: |-
Manages a CLC server.
See also [Complete API documentation](https://www.ctl.io/api-docs/v2/#servers-create-server).
Resources and Documentation:
- [Datacenter / Capability Map](https://www.ctl.io/data-centers/)
- [Hyperscale](https://www.ctl.io/hyperscale/) and [Bare Metal](https://www.ctl.io/bare-metal/) Servers
- [REST API](https://www.ctl.io/api-docs/v2/#servers-create-server)
## Example Usage
@ -65,11 +70,54 @@ The following arguments are supported:
When absent, the default network will be used.
* `storage_type` - (Optional, string) Backup and replication strategy for disks.
One of "standard", "premium"
* `aa_policy_id` - (Optional, string | hyperscale) Anti-Affinity policy ID
* `configuration_id` - (Optional, string | bareMetal) Hardware configuration ID
* `os_type` - (Optional, string | bareMetal) Operating system to install.
* `additional_disks` - (Optional) See [Disks](#disks) below for details.
* `custom_fields` - (Optional) See [CustomFields](#custom_fields) below for details.
* `metadata` - (Optional) Misc state storage for non-CLC metadata.
<a id="server-types"></a>
## Server Types
#### standard
Cloud servers `standard` offer basic, commodity level
performance with mixed spindle/SSD storage profiles. Additional
features storage backups, snapshot/clone/archive, and widespread
availability.
#### hyperscale
Hyperscale `hyperscale` servers offer significantly higher IOPS than standard
servers for CPU and IO intensive servers. See the
[FAQ](https://www.ctl.io/knowledge-base/servers/hyperscale-server-faq/)
for more details.
Physical host redundancy can be managed via
[Anti-Affinity policies](https://www.ctl.io/knowledge-base/servers/centurylink-cloud-anti-affinity-policies/).
#### bareMetal
Bare metal `bareMetal` offers optimal compute performance and is
available in select datacenters in CLC for approved customers. For
more info see the
[FAQ](https://www.ctl.io/knowledge-base/servers/bare-metal-faq/).
For `bareMetal`, the required fields `source_server_id`, `cpu`, and
`memory_mb` are ignored and instead the following fields are required:
- configuration_id
- os_type
Values for `configuration_id` and `os_type` are specific to each
datacenter and are available via the API endpoints
[here](https://www.ctl.io/api-docs/v2/#data-centers-get-data-center-bare-metal-capabilities).
<a id="power_states"></a>
## PowerStates
@ -127,3 +175,8 @@ provider "clc_server" "ubuntu" {
}
}
```