Guest User

Untitled

a guest
Jan 24th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.00 KB | None | 0 0
  1. diff --git a/openstack/config.go b/openstack/config.go
  2. index 48b8ceb..b6ceb85 100644
  3. --- a/openstack/config.go
  4. +++ b/openstack/config.go
  5. @@ -17,31 +17,34 @@ import (
  6. )
  7.  
  8. type Config struct {
  9. - CACertFile string
  10. - ClientCertFile string
  11. - ClientKeyFile string
  12. - Cloud string
  13. - DefaultDomain string
  14. - DomainID string
  15. - DomainName string
  16. - EndpointOverrides map[string]interface{}
  17. - EndpointType string
  18. - IdentityEndpoint string
  19. - Insecure *bool
  20. - Password string
  21. - ProjectDomainName string
  22. - ProjectDomainID string
  23. - Region string
  24. - Swauth bool
  25. - TenantID string
  26. - TenantName string
  27. - Token string
  28. - UserDomainName string
  29. - UserDomainID string
  30. - Username string
  31. - UserID string
  32. - useOctavia bool
  33. - MaxRetries int
  34. + CACertFile string
  35. + ClientCertFile string
  36. + ClientKeyFile string
  37. + Cloud string
  38. + DefaultDomain string
  39. + DomainID string
  40. + DomainName string
  41. + EndpointOverrides map[string]interface{}
  42. + EndpointType string
  43. + IdentityEndpoint string
  44. + Insecure *bool
  45. + Password string
  46. + ProjectDomainName string
  47. + ProjectDomainID string
  48. + Region string
  49. + Swauth bool
  50. + TenantID string
  51. + TenantName string
  52. + Token string
  53. + UserDomainName string
  54. + UserDomainID string
  55. + Username string
  56. + UserID string
  57. + ApplicationCredentialID string
  58. + ApplicationCredentialName string
  59. + ApplicationCredentialSecret string
  60. + useOctavia bool
  61. + MaxRetries int
  62.  
  63. OsClient *gophercloud.ProviderClient
  64. }
  65. @@ -108,20 +111,23 @@ func (c *Config) LoadAndValidate() error {
  66. }
  67. } else {
  68. authInfo := &clientconfig.AuthInfo{
  69. - AuthURL: c.IdentityEndpoint,
  70. - DefaultDomain: c.DefaultDomain,
  71. - DomainID: c.DomainID,
  72. - DomainName: c.DomainName,
  73. - Password: c.Password,
  74. - ProjectDomainID: c.ProjectDomainID,
  75. - ProjectDomainName: c.ProjectDomainName,
  76. - ProjectID: c.TenantID,
  77. - ProjectName: c.TenantName,
  78. - Token: c.Token,
  79. - UserDomainID: c.UserDomainID,
  80. - UserDomainName: c.UserDomainName,
  81. - Username: c.Username,
  82. - UserID: c.UserID,
  83. + AuthURL: c.IdentityEndpoint,
  84. + DefaultDomain: c.DefaultDomain,
  85. + DomainID: c.DomainID,
  86. + DomainName: c.DomainName,
  87. + Password: c.Password,
  88. + ProjectDomainID: c.ProjectDomainID,
  89. + ProjectDomainName: c.ProjectDomainName,
  90. + ProjectID: c.TenantID,
  91. + ProjectName: c.TenantName,
  92. + Token: c.Token,
  93. + UserDomainID: c.UserDomainID,
  94. + UserDomainName: c.UserDomainName,
  95. + Username: c.Username,
  96. + UserID: c.UserID,
  97. + ApplicationCredentialID: c.ApplicationCredentialID,
  98. + ApplicationCredentialName: c.ApplicationCredentialName,
  99. + ApplicationCredentialSecret: c.ApplicationCredentialSecret,
  100. }
  101. clientOpts.AuthInfo = authInfo
  102. }
  103. diff --git a/openstack/provider.go b/openstack/provider.go
  104. index e1777e2..6bb8155 100644
  105. --- a/openstack/provider.go
  106. +++ b/openstack/provider.go
  107. @@ -41,6 +41,27 @@ func Provider() terraform.ResourceProvider {
  108. Description: descriptions["user_name"],
  109. },
  110.  
  111. + "application_credential_id": {
  112. + Type: schema.TypeString,
  113. + Optional: true,
  114. + DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_ID", ""),
  115. + Description: descriptions["application_credential_id"],
  116. + },
  117. +
  118. + "application_credential_name": {
  119. + Type: schema.TypeString,
  120. + Optional: true,
  121. + DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_NAME", ""),
  122. + Description: descriptions["application_credential_name"],
  123. + },
  124. +
  125. + "application_credential_secret": {
  126. + Type: schema.TypeString,
  127. + Optional: true,
  128. + DefaultFunc: schema.EnvDefaultFunc("OS_APPLICATION_CREDENTIAL_SECRET", ""),
  129. + Description: descriptions["application_credential_secret"],
  130. + },
  131. +
  132. "tenant_id": {
  133. Type: schema.TypeString,
  134. Optional: true,
  135. @@ -312,6 +333,12 @@ func init() {
  136.  
  137. "user_id": "User ID to login with.",
  138.  
  139. + "application_credential_id": "Application Credential ID to login with.",
  140. +
  141. + "application_credential_name": "Application Credential name to login with.",
  142. +
  143. + "application_credential_secret": "Application Credential secret to login with.",
  144. +
  145. "tenant_id": "The ID of the Tenant (Identity v2) or Project (Identity v3)\n" +
  146. "to login with.",
  147.  
  148. @@ -363,30 +390,33 @@ func init() {
  149.  
  150. func configureProvider(d *schema.ResourceData) (interface{}, error) {
  151. config := Config{
  152. - CACertFile: d.Get("cacert_file").(string),
  153. - ClientCertFile: d.Get("cert").(string),
  154. - ClientKeyFile: d.Get("key").(string),
  155. - Cloud: d.Get("cloud").(string),
  156. - DefaultDomain: d.Get("default_domain").(string),
  157. - DomainID: d.Get("domain_id").(string),
  158. - DomainName: d.Get("domain_name").(string),
  159. - EndpointOverrides: d.Get("endpoint_overrides").(map[string]interface{}),
  160. - EndpointType: d.Get("endpoint_type").(string),
  161. - IdentityEndpoint: d.Get("auth_url").(string),
  162. - Password: d.Get("password").(string),
  163. - ProjectDomainID: d.Get("project_domain_id").(string),
  164. - ProjectDomainName: d.Get("project_domain_name").(string),
  165. - Region: d.Get("region").(string),
  166. - Swauth: d.Get("swauth").(bool),
  167. - Token: d.Get("token").(string),
  168. - TenantID: d.Get("tenant_id").(string),
  169. - TenantName: d.Get("tenant_name").(string),
  170. - UserDomainID: d.Get("user_domain_id").(string),
  171. - UserDomainName: d.Get("user_domain_name").(string),
  172. - Username: d.Get("user_name").(string),
  173. - UserID: d.Get("user_id").(string),
  174. - useOctavia: d.Get("use_octavia").(bool),
  175. - MaxRetries: d.Get("max_retries").(int),
  176. + CACertFile: d.Get("cacert_file").(string),
  177. + ClientCertFile: d.Get("cert").(string),
  178. + ClientKeyFile: d.Get("key").(string),
  179. + Cloud: d.Get("cloud").(string),
  180. + DefaultDomain: d.Get("default_domain").(string),
  181. + DomainID: d.Get("domain_id").(string),
  182. + DomainName: d.Get("domain_name").(string),
  183. + EndpointOverrides: d.Get("endpoint_overrides").(map[string]interface{}),
  184. + EndpointType: d.Get("endpoint_type").(string),
  185. + IdentityEndpoint: d.Get("auth_url").(string),
  186. + Password: d.Get("password").(string),
  187. + ProjectDomainID: d.Get("project_domain_id").(string),
  188. + ProjectDomainName: d.Get("project_domain_name").(string),
  189. + Region: d.Get("region").(string),
  190. + Swauth: d.Get("swauth").(bool),
  191. + Token: d.Get("token").(string),
  192. + TenantID: d.Get("tenant_id").(string),
  193. + TenantName: d.Get("tenant_name").(string),
  194. + UserDomainID: d.Get("user_domain_id").(string),
  195. + UserDomainName: d.Get("user_domain_name").(string),
  196. + Username: d.Get("user_name").(string),
  197. + UserID: d.Get("user_id").(string),
  198. + ApplicationCredentialID: d.Get("application_credential_id").(string),
  199. + ApplicationCredentialName: d.Get("application_credential_name").(string),
  200. + ApplicationCredentialSecret: d.Get("application_credential_secret").(string),
  201. + useOctavia: d.Get("use_octavia").(bool),
  202. + MaxRetries: d.Get("max_retries").(int),
  203. }
  204.  
  205. v, ok := d.GetOkExists("insecure")
Add Comment
Please, Sign In to add comment