Skip to content

Commit

Permalink
nexus_repository: Add HTTP client authentication password to state to f…
Browse files Browse the repository at this point in the history
…ix #58
  • Loading branch information
Nosmoht committed Jul 7, 2020
1 parent 2c69a96 commit a8e0e9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nexus/resource_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func setRepositoryToResourceData(repo *nexus.Repository, d *schema.ResourceData)
}

if repo.RepositoryHTTPClient != nil {
if err := d.Set("http_client", flattenRepositoryHTTPClient(repo.RepositoryHTTPClient)); err != nil {
if err := d.Set("http_client", flattenRepositoryHTTPClient(repo.RepositoryHTTPClient, d)); err != nil {
return err
}
}
Expand Down Expand Up @@ -805,20 +805,20 @@ func flattenRepositoryGroup(group *nexus.RepositoryGroup) []map[string]interface
return []map[string]interface{}{data}
}

func flattenRepositoryHTTPClient(httpClient *nexus.RepositoryHTTPClient) []map[string]interface{} {
func flattenRepositoryHTTPClient(httpClient *nexus.RepositoryHTTPClient, d *schema.ResourceData) []map[string]interface{} {
if httpClient == nil {
return nil
}
data := map[string]interface{}{
"authentication": flattenRepositoryHTTPClientAuthentication(httpClient.Authentication),
"authentication": flattenRepositoryHTTPClientAuthentication(httpClient.Authentication, d),
"auto_block": httpClient.AutoBlock,
"blocked": httpClient.Blocked,
// "connection": flattenRepositoryHTTPClientConnection(httpClient.Connection),
}
return []map[string]interface{}{data}
}

func flattenRepositoryHTTPClientAuthentication(auth *nexus.RepositoryHTTPClientAuthentication) []map[string]interface{} {
func flattenRepositoryHTTPClientAuthentication(auth *nexus.RepositoryHTTPClientAuthentication, d *schema.ResourceData) []map[string]interface{} {
if auth == nil {
return nil
}
Expand All @@ -827,6 +827,7 @@ func flattenRepositoryHTTPClientAuthentication(auth *nexus.RepositoryHTTPClientA
"ntlm_host": auth.NTLMHost,
"type": auth.Type,
"username": auth.Username,
"password": d.Get("http_client.0.authentication.0.password").(string),
}
return []map[string]interface{}{data}
}
Expand Down

0 comments on commit a8e0e9e

Please sign in to comment.