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

fix: check if no registies are found because none exist, wrong user a… #646

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions ionoscloud/data_source_container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@ func dataSourceContainerRegistryRead(ctx context.Context, d *schema.ResourceData
}
}

if len(results) > 1 {
switch {
case len(results) == 0:
return diag.FromErr(fmt.Errorf("no registry found with the specified criteria: name = %s location = %s", name, location))
case len(results) > 1:
return diag.FromErr(fmt.Errorf("more than one registry found with the specified criteria: name = %s location = %s", name, location))
default:
registry = results[0]
}

registry = results[0]

}

if err := crService.SetRegistryData(d, registry); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion services/autoscaling/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewClient(username, password, token, url, version, terraformVersion string)
newAutoscalingConfig.MaxWaitTime = constant.MaxWaitTime
newAutoscalingConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport()}
newAutoscalingConfig.UserAgent = fmt.Sprintf(
"terraform-provider/%s_ionos-cloud-sdk-go-logging/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s",
"terraform-provider/%s_ionos-cloud-sdk-go-vm-autoscaling/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s",
version, autoscaling.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH) //nolint:staticcheck

return &Client{sdkClient: autoscaling.NewAPIClient(newAutoscalingConfig)}
Expand Down
Loading