Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the API parameter from user to username #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions zabbix/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func Provider() *schema.Provider {
p := &schema.Provider{
Schema: map[string]*schema.Schema{
"user": &schema.Schema{
"username": &schema.Schema{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it is required to rename the provider attribute, as it is a breaking change.
Even so less if we want to maintain compatibility with older Zabbix versions which use user.

Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("ZABBIX_USER", nil),
Expand Down Expand Up @@ -87,7 +87,7 @@ func providerConfigure(d *schema.ResourceData, terraformVersion string) (interfa

api.SetClient(client)

if _, err := api.Login(d.Get("user").(string), d.Get("password").(string)); err != nil {
if _, err := api.Login(d.Get("username").(string), d.Get("password").(string)); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply changing user into username will break compatibility with Zabbix versions older than 5.4

ZBXNEXT-6474 user.login: Renamed parameter user → username.

https://www.zabbix.com/documentation/5.4/en/manual/api/changes_5.2_-_5.4#user

return nil, err
}

Expand Down