Merge pull request #6081 from jtopjian/openstack-token-auth
provider/openstack: Enable Token Authentication
This commit is contained in:
commit
db3e731cf3
|
@ -15,6 +15,7 @@ type Config struct {
|
||||||
Username string
|
Username string
|
||||||
UserID string
|
UserID string
|
||||||
Password string
|
Password string
|
||||||
|
Token string
|
||||||
APIKey string
|
APIKey string
|
||||||
IdentityEndpoint string
|
IdentityEndpoint string
|
||||||
TenantID string
|
TenantID string
|
||||||
|
@ -41,6 +42,7 @@ func (c *Config) loadAndValidate() error {
|
||||||
Username: c.Username,
|
Username: c.Username,
|
||||||
UserID: c.UserID,
|
UserID: c.UserID,
|
||||||
Password: c.Password,
|
Password: c.Password,
|
||||||
|
TokenID: c.Token,
|
||||||
APIKey: c.APIKey,
|
APIKey: c.APIKey,
|
||||||
IdentityEndpoint: c.IdentityEndpoint,
|
IdentityEndpoint: c.IdentityEndpoint,
|
||||||
TenantID: c.TenantID,
|
TenantID: c.TenantID,
|
||||||
|
|
|
@ -17,7 +17,7 @@ func Provider() terraform.ResourceProvider {
|
||||||
"user_name": &schema.Schema{
|
"user_name": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("OS_USERNAME", nil),
|
DefaultFunc: schema.EnvDefaultFunc("OS_USERNAME", ""),
|
||||||
},
|
},
|
||||||
"user_id": &schema.Schema{
|
"user_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
@ -37,12 +37,17 @@ func Provider() terraform.ResourceProvider {
|
||||||
"password": &schema.Schema{
|
"password": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("OS_PASSWORD", nil),
|
DefaultFunc: schema.EnvDefaultFunc("OS_PASSWORD", ""),
|
||||||
|
},
|
||||||
|
"token": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
DefaultFunc: schema.EnvDefaultFunc("OS_AUTH_TOKEN", ""),
|
||||||
},
|
},
|
||||||
"api_key": &schema.Schema{
|
"api_key": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("OS_AUTH_TOKEN", ""),
|
DefaultFunc: schema.EnvDefaultFunc("OS_API_KEY", ""),
|
||||||
},
|
},
|
||||||
"domain_id": &schema.Schema{
|
"domain_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
@ -104,6 +109,7 @@ func configureProvider(d *schema.ResourceData) (interface{}, error) {
|
||||||
Username: d.Get("user_name").(string),
|
Username: d.Get("user_name").(string),
|
||||||
UserID: d.Get("user_id").(string),
|
UserID: d.Get("user_id").(string),
|
||||||
Password: d.Get("password").(string),
|
Password: d.Get("password").(string),
|
||||||
|
Token: d.Get("token").(string),
|
||||||
APIKey: d.Get("api_key").(string),
|
APIKey: d.Get("api_key").(string),
|
||||||
TenantID: d.Get("tenant_id").(string),
|
TenantID: d.Get("tenant_id").(string),
|
||||||
TenantName: d.Get("tenant_name").(string),
|
TenantName: d.Get("tenant_name").(string),
|
||||||
|
|
|
@ -46,7 +46,18 @@ The following arguments are supported:
|
||||||
* `password` - (Optional; Required if not using `api_key`) If omitted, the
|
* `password` - (Optional; Required if not using `api_key`) If omitted, the
|
||||||
`OS_PASSWORD` environment variable is used.
|
`OS_PASSWORD` environment variable is used.
|
||||||
|
|
||||||
* `api_key` - (Optional; Required if not using `password`)
|
* `token` - (Optional; Required if not using `user_name` and `password`)
|
||||||
|
A token is an expiring, temporary means of access issued via the
|
||||||
|
Keystone service. By specifying a token, you do not have to
|
||||||
|
specify a username/password combination, since the token was
|
||||||
|
already created by a username/password out of band of Terraform.
|
||||||
|
If ommitted, the `OS_AUTH_TOKEN` environment variable is used.
|
||||||
|
|
||||||
|
* `api_key` - (Optional; Required if not using `password`) An API Key
|
||||||
|
is issued by a cloud provider as alternative password. Unless
|
||||||
|
your cloud provider has documentation referencing an API Key,
|
||||||
|
you can safely ignore this argument. If omitted, the `OS_API_KEY`
|
||||||
|
environment variable is used.
|
||||||
|
|
||||||
* `domain_id` - (Optional) If omitted, the `OS_DOMAIN_ID` environment
|
* `domain_id` - (Optional) If omitted, the `OS_DOMAIN_ID` environment
|
||||||
variable is used.
|
variable is used.
|
||||||
|
|
Loading…
Reference in New Issue