Skip to content

Commit

Permalink
Fix: private only endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kavya498 committed Jul 23, 2021
1 parent e1acdea commit 3df4a9c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/IBM/go-sdk-core/v5 v5.5.1
github.com/IBM/ibm-cos-sdk-go v1.7.0
github.com/IBM/ibm-cos-sdk-go-config v1.2.0
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210716185544-e8403b3501ef
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210723145459-a232c3f3ac91
github.com/IBM/keyprotect-go-client v0.7.0
github.com/IBM/networking-go-sdk v0.18.0
github.com/IBM/platform-services-go-sdk v0.18.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ github.com/IBM/ibm-cos-sdk-go v1.7.0 h1:3DZULY/D5WzjlIm+Iaj6h0surEjQs65EZk1YAe8+
github.com/IBM/ibm-cos-sdk-go v1.7.0/go.mod h1:Oi8AC5WNDhmUJgbo1GL2FtBdo0nRgbzE/1HmCL1SERU=
github.com/IBM/ibm-cos-sdk-go-config v1.2.0 h1:1E93234yZgVS0ntm7eUwVb3h0AAayPGcxEhhizEN1LE=
github.com/IBM/ibm-cos-sdk-go-config v1.2.0/go.mod h1:Wetfgv6m1xyuzpZLQTTLIBsWstxjYa15h+Utj7x53Dk=
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210716185544-e8403b3501ef h1:x7xHqeuiTUfvozRQo3qt7W1qispGpLsDXqnBfXpkvYY=
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210716185544-e8403b3501ef/go.mod h1:M2JyuyeWHPtgGNeezr6YqVRuaav2MpY8Ha4QrEYvMoI=
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210723145459-a232c3f3ac91 h1:8ICDvg7YM+PmfF+LQ42D4w/p4QEpiknbycAgGdbk0dw=
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20210723145459-a232c3f3ac91/go.mod h1:M2JyuyeWHPtgGNeezr6YqVRuaav2MpY8Ha4QrEYvMoI=
github.com/IBM/keyprotect-go-client v0.7.0 h1:JstSHD14Lp6ihwQseyPuGcs1AjOBjAmcisP0dTBA6A0=
github.com/IBM/keyprotect-go-client v0.7.0/go.mod h1:SVr2ylV/fhSQPDiUjWirN9fsyWFCNNbt8GIT8hPJVjE=
github.com/IBM/networking-go-sdk v0.18.0 h1:mlALxXptnoDGviRW59ZQTyCr4PgTdQKp/5ksh2NM6Sk=
Expand Down
13 changes: 9 additions & 4 deletions ibm/resource_ibm_hpcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ func resourceIBMHPCS() *schema.Resource {
Computed: true,
},
"service_endpoints": {
Description: "Types of the service endpoints. Possible values are 'public', 'private', 'public-and-private'.",
Description: "Types of the service endpoints. Possible values are `public-and-private`, `private-only`.",
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateAllowedStringValue([]string{"public", "private", "public-and-private"}),
ValidateFunc: validateAllowedStringValue([]string{"public-and-private", "private-only"}),
},
"tags": {
Type: schema.TypeSet,
Expand Down Expand Up @@ -307,7 +307,7 @@ func resourceIBMHPCS() *schema.Resource {
type HPCSParams struct {
Units int `json:"units,omitempty"`
FailoverUnits int `json:"failover_units,omitempty"`
ServiceEndpoints string `json:"service-endpoints,omitempty"`
ServiceEndpoints string `json:"allowed_network,omitempty"`
}

func resourceIBMHPCSValidator() *ResourceValidator {
Expand Down Expand Up @@ -880,11 +880,16 @@ func hsmClient(d *schema.ResourceData, meta interface{}) (tkesdk.CommonInputs, e
if err != nil {
return ci, fmt.Errorf("[ERROR] Error Refreshing Authentication Token: %s", err)
}
var serviceEndpoint string
if e, ok := d.GetOk("service_endpoints"); ok {
serviceEndpoint = e.(string)
}
ci.Region = d.Get("location").(string)
ci.ApiEndpoint = envFallBack([]string{"IBMCLOUD_HPCS_TKE_ENDPOINT"}, "cloud.ibm.com")
if bluemixSession.Config.Visibility == "private" || bluemixSession.Config.Visibility == "public-and-private" {
if bluemixSession.Config.Visibility == "private" || bluemixSession.Config.Visibility == "public-and-private" || serviceEndpoint == "private-only" {
ci.ApiEndpoint = envFallBack([]string{"IBMCLOUD_HPCS_TKE_ENDPOINT"}, "private.cloud.ibm.com")
}

ci.AuthToken = bluemixSession.Config.IAMAccessToken

return ci, err
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/hpcs.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The following arguments are supported:
* `plan` - (Required, string) The pricing plan for your service instance. Currently, only the standard plan is supportd.
* `resource_group_id` - (Optional, string) The Id of resource group where you want to organize and manage your service instance.
* `revocation_threshold` - (Required, int) The number of administrator signatures that is required to remove an administrator after you leave imprint mode. The valid value is between 1 and 8.
* `service_endpoints` - (Optional, string) Types of the service endpoints that can be set to a resource instance. Possible values are 'public', 'private', 'public-and-private'.
* `service_endpoints` - (Optional, string) Types of the service endpoints that can be set to a resource instance. Possible values are `public-and-private`, `private-only`.
* `signature_server_url` - (Optional, string) The URL of the signing service. If you use a third-party signing service to provide administrator signature keys, you need to specify the URL.
* `signature_threshold`- (Required, int) The number of administrator signatures that is required to execute administrative commands. The valid value is between 1 and 8. You need to set it to at least 2 to enable quorum authentication.
* `tags` - (Optional, array of strings) Tags that are associated with your instance are used to organize your resources.
Expand Down

0 comments on commit 3df4a9c

Please sign in to comment.