},
"password": &schema.Schema{
Type: schema.TypeString,
- Required: true,
+ Optional: true,
},
},
},
newCredential := j.(map[string]interface{})
if oldCredential["login"] == newCredential["login"] {
found = true
- if oldCredential["password"] != newCredential["password"] {
+ if oldCredential["password"] != newCredential["password"] && newCredential["password"] != "" {
err := mg.ChangeCredentialPassword(ctx, oldCredential["login"].(string), newCredential["password"].(string))
if err != nil {
return fmt.Errorf("Error updating mailgun credential password: %s", err.Error())
return fmt.Errorf("Error Getting mailgun domain Details for %s: Error: %s", d.Id(), err)
}
- d.Set("created_at", domainResponse.Domain.CreatedAt)
+ d.Set("created_at", domainResponse.Domain.CreatedAt.String())
d.Set("smtd_login", domainResponse.Domain.SMTPLogin)
d.Set("name", domainResponse.Domain.Name)
d.Set("smtd_password", domainResponse.Domain.SMTPPassword)
}
credentials := make([]map[string]interface{}, len(credentialsResponse))
+ credentialsConf := d.Get("credentials").([]interface{})
for i, r := range credentialsResponse {
credentials[i] = make(map[string]interface{})
- credentials[i]["created_at"] = r.CreatedAt
+ credentials[i]["created_at"] = r.CreatedAt.String()
credentials[i]["login"] = r.Login
- credentials[i]["password"] = r.Password
+ for _, c:= range credentialsConf {
+ conf:=c.(map[string]interface{})
+ if conf["login"] == credentials[i]["login"] {
+ credentials[i]["password"] = conf["password"]
+ }
+ }
}
+
d.Set("credentials", credentials)
d.SetId(domainName)
d.Set("description", route.Description)
d.Set("expression", route.Expression)
d.Set("actions", route.Actions)
- d.Set("created_at", route.CreatedAt)
+ d.Set("created_at", route.CreatedAt.String())
d.Set("route_id", route.Id)
d.SetId(route.Id)