Created
January 23, 2019 12:16
-
-
Save kayrus/a53a1c805d2ce5d5e97244a5e1a895c1 to your computer and use it in GitHub Desktop.
openstack.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/openstack/config.go b/openstack/config.go | |
index 48b8ceb..b6ceb85 100644 | |
--- a/openstack/config.go | |
+++ b/openstack/config.go | |
@@ -17,31 +17,34 @@ import ( | |
) | |
type Config struct { | |
- CACertFile string | |
- ClientCertFile string | |
- ClientKeyFile string | |
- Cloud string | |
- DefaultDomain string | |
- DomainID string | |
- DomainName string | |
- EndpointOverrides map[string]interface{} | |
- EndpointType string | |
- IdentityEndpoint string | |
- Insecure *bool | |
- Password string | |
- ProjectDomainName string | |
- ProjectDomainID string | |
- Region string | |
- Swauth bool | |
- TenantID string | |
- TenantName string | |
- Token string | |
- UserDomainName string | |
- UserDomainID string | |
- Username string | |
- UserID string | |
- useOctavia bool | |
- MaxRetries int | |
+ CACertFile string | |
+ ClientCertFile string | |
+ ClientKeyFile string | |
+ Cloud string | |
+ DefaultDomain string | |
+ DomainID string | |
+ DomainName string | |
+ EndpointOverrides map[string]interface{} | |
+ EndpointType string | |
+ IdentityEndpoint string | |
+ Insecure *bool | |
+ Password string | |
+ ProjectDomainName string | |
+ ProjectDomainID string | |
+ Region string | |
+ Swauth bool | |
+ TenantID string | |
+ TenantName string | |
+ Token string | |
+ UserDomainName string | |
+ UserDomainID string | |
+ Username string | |
+ UserID string | |
+ ApplicationCredentialID string | |
+ ApplicationCredentialName string | |
+ ApplicationCredentialSecret string | |
+ useOctavia bool | |
+ MaxRetries int | |
OsClient *gophercloud.ProviderClient | |
} | |
@@ -108,20 +111,23 @@ func (c *Config) LoadAndValidate() error { | |
} | |
} else { | |
authInfo := &clientconfig.AuthInfo{ | |
- AuthURL: c.IdentityEndpoint, | |
- DefaultDomain: c.DefaultDomain, | |
- DomainID: c.DomainID, | |
- DomainName: c.DomainName, | |
- Password: c.Password, | |
- ProjectDomainID: c.ProjectDomainID, | |
- ProjectDomainName: c.ProjectDomainName, | |
- ProjectID: c.TenantID, | |
- ProjectName: c.TenantName, | |
- Token: c.Token, | |
- UserDomainID: c.UserDomainID, | |
- UserDomainName: c.UserDomainName, | |
- Username: c.Username, | |
- UserID: c.UserID, | |
+ AuthURL: c.IdentityEndpoint, | |
+ DefaultDomain: c.DefaultDomain, | |
+ DomainID: c.DomainID, | |
+ DomainName: c.DomainName, | |
+ Password: c.Password, | |
+ ProjectDomainID: c.ProjectDomainID, | |
+ ProjectDomainName: c.ProjectDomainName, | |
+ ProjectID: c.TenantID, | |
+ ProjectName: c.TenantName, | |
+ Token: c.Token, | |
+ UserDomainID: c.UserDomainID, | |
+ UserDomainName: c.UserDomainName, | |
+ Username: c.Username, | |
+ UserID: c.UserID, | |
+ ApplicationCredentialID: c.ApplicationCredentialID, | |
+ ApplicationCredentialName: c.ApplicationCredentialName, | |
+ ApplicationCredentialSecret: c.ApplicationCredentialSecret, | |
} | |
clientOpts.AuthInfo = authInfo | |
} | |
diff --git a/openstack/provider.go b/openstack/provider.go | |
index e1777e2..6bb8155 100644 | |
--- a/openstack/provider.go | |
+++ b/openstack/provider.go | |
@@ -41,6 +41,27 @@ func Provider() terraform.ResourceProvider { | |
Description: descriptions["user_name"], | |
}, | |
+ "application_credential_id": { | |
+ Type: schema.TypeString, | |
+ Optional: true, | |
+ DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_ID", ""), | |
+ Description: descriptions["application_credential_id"], | |
+ }, | |
+ | |
+ "application_credential_name": { | |
+ Type: schema.TypeString, | |
+ Optional: true, | |
+ DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_NAME", ""), | |
+ Description: descriptions["application_credential_name"], | |
+ }, | |
+ | |
+ "application_credential_secret": { | |
+ Type: schema.TypeString, | |
+ Optional: true, | |
+ DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_SECRET", ""), | |
+ Description: descriptions["application_credential_secret"], | |
+ }, | |
+ | |
"tenant_id": { | |
Type: schema.TypeString, | |
Optional: true, | |
@@ -312,6 +333,12 @@ func init() { | |
"user_id": "User ID to login with.", | |
+ "application_credential_id": "Application Credential ID to login with.", | |
+ | |
+ "application_credential_name": "Application Credential name to login with.", | |
+ | |
+ "application_credential_secret": "Application Credential secret to login with.", | |
+ | |
"tenant_id": "The ID of the Tenant (Identity v2) or Project (Identity v3)\n" + | |
"to login with.", | |
@@ -363,30 +390,33 @@ func init() { | |
func configureProvider(d *schema.ResourceData) (interface{}, error) { | |
config := Config{ | |
- CACertFile: d.Get("cacert_file").(string), | |
- ClientCertFile: d.Get("cert").(string), | |
- ClientKeyFile: d.Get("key").(string), | |
- Cloud: d.Get("cloud").(string), | |
- DefaultDomain: d.Get("default_domain").(string), | |
- DomainID: d.Get("domain_id").(string), | |
- DomainName: d.Get("domain_name").(string), | |
- EndpointOverrides: d.Get("endpoint_overrides").(map[string]interface{}), | |
- EndpointType: d.Get("endpoint_type").(string), | |
- IdentityEndpoint: d.Get("auth_url").(string), | |
- Password: d.Get("password").(string), | |
- ProjectDomainID: d.Get("project_domain_id").(string), | |
- ProjectDomainName: d.Get("project_domain_name").(string), | |
- Region: d.Get("region").(string), | |
- Swauth: d.Get("swauth").(bool), | |
- Token: d.Get("token").(string), | |
- TenantID: d.Get("tenant_id").(string), | |
- TenantName: d.Get("tenant_name").(string), | |
- UserDomainID: d.Get("user_domain_id").(string), | |
- UserDomainName: d.Get("user_domain_name").(string), | |
- Username: d.Get("user_name").(string), | |
- UserID: d.Get("user_id").(string), | |
- useOctavia: d.Get("use_octavia").(bool), | |
- MaxRetries: d.Get("max_retries").(int), | |
+ CACertFile: d.Get("cacert_file").(string), | |
+ ClientCertFile: d.Get("cert").(string), | |
+ ClientKeyFile: d.Get("key").(string), | |
+ Cloud: d.Get("cloud").(string), | |
+ DefaultDomain: d.Get("default_domain").(string), | |
+ DomainID: d.Get("domain_id").(string), | |
+ DomainName: d.Get("domain_name").(string), | |
+ EndpointOverrides: d.Get("endpoint_overrides").(map[string]interface{}), | |
+ EndpointType: d.Get("endpoint_type").(string), | |
+ IdentityEndpoint: d.Get("auth_url").(string), | |
+ Password: d.Get("password").(string), | |
+ ProjectDomainID: d.Get("project_domain_id").(string), | |
+ ProjectDomainName: d.Get("project_domain_name").(string), | |
+ Region: d.Get("region").(string), | |
+ Swauth: d.Get("swauth").(bool), | |
+ Token: d.Get("token").(string), | |
+ TenantID: d.Get("tenant_id").(string), | |
+ TenantName: d.Get("tenant_name").(string), | |
+ UserDomainID: d.Get("user_domain_id").(string), | |
+ UserDomainName: d.Get("user_domain_name").(string), | |
+ Username: d.Get("user_name").(string), | |
+ UserID: d.Get("user_id").(string), | |
+ ApplicationCredentialID: d.Get("application_credential_id").(string), | |
+ ApplicationCredentialName: d.Get("application_credential_name").(string), | |
+ ApplicationCredentialSecret: d.Get("application_credential_secret").(string), | |
+ useOctavia: d.Get("use_octavia").(bool), | |
+ MaxRetries: d.Get("max_retries").(int), | |
} | |
v, ok := d.GetOkExists("insecure") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment