[clc] re-add alias as an optional field. update docs

This commit is contained in:
Albert Choi 2016-03-22 08:38:56 -07:00
parent dcf0974d1e
commit 8de8c6884d
6 changed files with 39 additions and 22 deletions

36
Godeps/Godeps.json generated
View File

@ -152,48 +152,48 @@
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
"Comment": "0.0.2-19-gbe16cca",
"Rev": "be16cca3fa780c77916e52370a9c89cc53bcf73a"
"Comment": "0.0.2-20-gd546567",
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
},
{
"ImportPath": "github.com/DreamItGetIT/statuscake",

View File

@ -30,6 +30,12 @@ func Provider() terraform.ResourceProvider {
DefaultFunc: schema.EnvDefaultFunc("CLC_PASSWORD", nil),
Description: "Your CLC password",
},
"account": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("CLC_ACCOUNT", ""),
Description: "Account alias override",
},
},
ResourcesMap: map[string]*schema.Resource{
@ -53,6 +59,10 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
return nil, fmt.Errorf("Failed to create CLC config with provided details: %v", err)
}
config.UserAgent = fmt.Sprintf("terraform-clc terraform/%s", terraform.Version)
// user requested alias override or sub-account
if al := d.Get("account").(string); al != "" {
config.Alias = al
}
client := clc.New(config)
if err := client.Authenticate(); err != nil {

View File

@ -78,7 +78,7 @@ func (c *Client) Auth() error {
}
err = c.Do(req, &c.Token)
if err == nil {
if err == nil && c.config.Alias == "" {
// set Alias from returned token
c.config.Alias = c.Token.Alias
}

View File

@ -25,7 +25,7 @@ For additional documentation, see the [CLC Developer Center](https://www.ctl.io/
provider "clc" {
username = "${var.clc_username}"
password = "${var.clc_password}"
account = "${var.clc_account}"
account = "${var.clc_account}" # optional
}
# Create a server
@ -55,5 +55,5 @@ The following arguments are supported:
* `clc_password` - (Required) This is the CLC account password. It must be provided, but
it can also be sourced from the `CLC_PASSWORD` environment variable.
* `clc_account` - (Required) This is the CLC account alias. It must be provided, but
it can also be sourced from the `CLC_ACCOUNT` environment variable.
* `clc_account` - (Optional) Override CLC account alias. Also taken from the `CLC_ACCOUNT`
environment variable if provided.

View File

@ -29,6 +29,12 @@ resource "clc_load_balancer_pool" "pool" {
ipAddress = "${clc_server.node.0.private_ip_address}"
privatePort = 3000
}
nodes
{
status = "enabled"
ipAddress = "${clc_server.node.1.private_ip_address}"
privatePort = 3000
}
}
output "pool" {

View File

@ -67,6 +67,7 @@ The following arguments are supported:
One of "standard", "premium"
* `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.