Merge pull request #5124 from rickard-von-essen/cloudstack-env
cloudstack: Allow reading api_url, api_key, and secret_key from env vars
This commit is contained in:
commit
12525507a7
|
@ -79,6 +79,21 @@ func NewConfig(raws ...interface{}) (*Config, error) {
|
||||||
var errs *packer.MultiError
|
var errs *packer.MultiError
|
||||||
|
|
||||||
// Set some defaults.
|
// Set some defaults.
|
||||||
|
if c.APIURL == "" {
|
||||||
|
// Default to environment variable for api_url, if it exists
|
||||||
|
c.APIURL = os.Getenv("CLOUDSTACK_API_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.APIKey == "" {
|
||||||
|
// Default to environment variable for api_key, if it exists
|
||||||
|
c.APIKey = os.Getenv("CLOUDSTACK_API_KEY")
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.SecretKey == "" {
|
||||||
|
// Default to environment variable for secret_key, if it exists
|
||||||
|
c.SecretKey = os.Getenv("CLOUDSTACK_SECRET_KEY")
|
||||||
|
}
|
||||||
|
|
||||||
if c.AsyncTimeout == 0 {
|
if c.AsyncTimeout == 0 {
|
||||||
c.AsyncTimeout = 30 * time.Minute
|
c.AsyncTimeout = 30 * time.Minute
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,12 @@ builder.
|
||||||
### Required:
|
### Required:
|
||||||
|
|
||||||
- `api_url` (string) - The CloudStack API endpoint we will connect to.
|
- `api_url` (string) - The CloudStack API endpoint we will connect to.
|
||||||
|
It can also be specified via environment variable `CLOUDSTACK_API_URL`,
|
||||||
|
if set.
|
||||||
|
|
||||||
- `api_key` (string) - The API key used to sign all API requests.
|
- `api_key` (string) - The API key used to sign all API requests. It
|
||||||
|
can also be specified via environment variable `CLOUDSTACK_API_KEY`,
|
||||||
|
if set.
|
||||||
|
|
||||||
- `cidr_list` (array) - List of CIDR's that will have access to the new
|
- `cidr_list` (array) - List of CIDR's that will have access to the new
|
||||||
instance. This is needed in order for any provisioners to be able to
|
instance. This is needed in order for any provisioners to be able to
|
||||||
|
@ -49,6 +53,8 @@ builder.
|
||||||
to.
|
to.
|
||||||
|
|
||||||
- `secret_key` (string) - The secret key used to sign all API requests.
|
- `secret_key` (string) - The secret key used to sign all API requests.
|
||||||
|
It can also be specified via environment variable `CLOUDSTACK_SECRET_KEY`,
|
||||||
|
if set.
|
||||||
|
|
||||||
- `service_offering` (string) - The name or ID of the service offering used
|
- `service_offering` (string) - The name or ID of the service offering used
|
||||||
for the instance.
|
for the instance.
|
||||||
|
|
Loading…
Reference in New Issue