summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxuzhang3 <Zhangxu894765>2022-10-24 14:25:18 +0800
committerxuzhang3 <Zhangxu894765>2022-10-24 14:25:18 +0800
commitd675bdfccd893a4fb9f4d4457b0a5c94717e6f8f (patch)
tree12c7d8ac50b56f59fbcddedc165d6c20d286a5ad
parent844117dde2e7d1525f05ae969220681b0e337b47 (diff)
fix token/pwd set to null
-rw-r--r--azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_artifactory.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_artifactory.go b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_artifactory.go
index fc7d2a47..90f1b65d 100644
--- a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_artifactory.go
+++ b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_artifactory.go
@@ -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))