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

US65433: In case of pce-d pass the space as workspaceID #245

Closed
wants to merge 1 commit into from
Closed
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
22 changes: 14 additions & 8 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package client

Expand Down Expand Up @@ -53,14 +53,20 @@ func (i InitialiseClient) NewClient(r *schema.ResourceData) (interface{}, error)

// Create VMaas Client
client := new(Client)

queryParam := map[string]string{
constants.LocationKey: vmaasProviderSettings[constants.LOCATION].(string),
}
space := vmaasProviderSettings[constants.SPACENAME].(string)
// check if glp then pass the space value as workspaceKey
if r.Get("iam_version").(string) == "glp" {
queryParam[constants.WorkspaceKey] = space
} else {
queryParam[constants.SpaceKey] = space
}
cfg := api_client.Configuration{
Host: vmaasProviderSettings[constants.APIURL].(string),
DefaultHeader: getHeaders(),
DefaultQueryParams: map[string]string{
constants.SpaceKey: vmaasProviderSettings[constants.SPACENAME].(string),
constants.LocationKey: vmaasProviderSettings[constants.LOCATION].(string),
},
Host: vmaasProviderSettings[constants.APIURL].(string),
DefaultHeader: getHeaders(),
DefaultQueryParams: queryParam,
}
apiClient := api_client.NewAPIClient(&cfg)
utils.SetMeta(apiClient, r)
Expand Down
15 changes: 8 additions & 7 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (C) Copyright 2021 Hewlett Packard Enterprise Development LP
// (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP

// Package constants - constants that are used in pkg/client and pkg/resources
package constants
Expand All @@ -8,12 +8,13 @@ const (
ServiceName = "vmaas"
ServiceURL = "https://iac-vmaas.us1.greenlake-hpe.com"

LOCATION = "location"
SPACENAME = "space_name"
APIURL = "api_url"
INSECURE = "allow_insecure"
SpaceKey = "space"
LocationKey = "location"
LOCATION = "location"
SPACENAME = "space_name"
APIURL = "api_url"
INSECURE = "allow_insecure"
SpaceKey = "space"
WorkspaceKey = "workspaceID"
LocationKey = "location"

MockIAMKey = "TF_ACC_MOCK_IAM"
CmpSubjectKey = "TF_ACC_CMP_SUBJECT"
Expand Down
Loading