fix token/pwd set to null
@@ -144,11 +144,9 @@ func flattenServiceEndpointArtifactory(d *schema.ResourceData, serviceEndpoint *
if len(authList) > 0 {
newHash, hashKey := tfhelper.HelpFlattenSecretNested(d, "authentication_token", authList, "token")
auth[hashKey] = newHash
+ auth["token"] = authList["token"]
}
}
- if serviceEndpoint.Authorization != nil && serviceEndpoint.Authorization.Parameters != nil {
- auth["token"] = (*serviceEndpoint.Authorization.Parameters)["apitoken"]
- }
d.Set("authentication_token", []interface{}{auth})
} else if strings.EqualFold(*serviceEndpoint.Authorization.Scheme, "UsernamePassword") {
auth := make(map[string]interface{})
@@ -159,12 +157,11 @@ func flattenServiceEndpointArtifactory(d *schema.ResourceData, serviceEndpoint *
auth[hashKey] = newHash
newHash, hashKey = tfhelper.HelpFlattenSecretNested(d, "authentication_basic", oldAuthList, "username")
auth[hashKey] = newHash
+
+ auth["password"] = oldAuthList["password"]
+ auth["username"] = oldAuthList["username"]
}
}
- if serviceEndpoint.Authorization != nil && serviceEndpoint.Authorization.Parameters != nil {
- auth["password"] = (*serviceEndpoint.Authorization.Parameters)["password"]
- auth["username"] = (*serviceEndpoint.Authorization.Parameters)["username"]
- }
d.Set("authentication_basic", []interface{}{auth})
} else {
panic(fmt.Errorf("inconsistent authorization scheme %s", *serviceEndpoint.Authorization.Scheme))
