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 endpoint URL #4120

Merged
merged 1 commit into from
Nov 3, 2022
Merged

Fix endpoint URL #4120

merged 1 commit into from
Nov 3, 2022

Conversation

Sidd-kp
Copy link
Contributor

@Sidd-kp Sidd-kp commented Oct 20, 2022

Description: This fix would allow users to provide endpoint url without "/api/v2/keys" without breaking backward compatibility.
Signed-off-by: Siddharth Mishra siddharth.mishra2@ibm.com

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

Signed-off-by: Siddharth Mishra <siddharth.mishra2@ibm.com>
Copy link

@dinesh-venkatraman-g dinesh-venkatraman-g left a comment

Choose a reason for hiding this comment

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

Thanks @Sidd-kp Can you attach following evidences for following scenarios:

  • When IBM KP End point URL is not set
    • private endpoint
    • public endpoint
  • When IBM KP End point URL is set without /v2/api/keys suffix
    • private
    • public
  • When IBM KP End point URL is set with /v2/api/keys suffix
    • private
    • public
    • Other resources like key ring, alias etc.,
  • Evidence that all test case are passing successfully

@Sidd-kp
Copy link
Contributor Author

Sidd-kp commented Oct 21, 2022

I am using the following script for all the test cases:
Cases:

  • IBM KP End point URL is not set

    • For Public:

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
          key_ring_id = ibm_kms_key_rings.key_ring.key_ring_id
          endpoint_type = "public"
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      Screenshot 2022-10-21 at 2 24 11 PM
    • For Private(Url is set correctly)

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
          service_endpoints = "private"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      
      Screenshot 2022-10-28 at 1 03 04 PM
  • IBM KP End point URL is set without /v2/api/keys suffix

    • For Public:

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
          key_ring_id = ibm_kms_key_rings.key_ring.key_ring_id
          endpoint_type = "public"
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      Screenshot 2022-10-28 at 1 19 03 PM
    • For Private:

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
          service_endpoints = "private"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      
      Screenshot 2022-10-28 at 1 49 34 PM
  • IBM KP End point URL is set with /v2/api/keys suffix

    • Public

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      
      Screenshot 2022-10-28 at 1 54 18 PM
    • Private

      Script
      provider "ibm" {}
      
      
      resource "ibm_resource_instance" "kms_instance" {
          name              = "kms_inst"
          service           = "kms"
          plan              = "tiered-pricing"
          location          = "us-south"
          service_endpoints = "private"
      }
      
      resource "ibm_kms_key_rings" "key_ring" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_ring_id   = "key-ring1"
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key" "test" {
          instance_id = ibm_resource_instance.kms_instance.guid
          key_name = "key1"
          standard_key =  false
          endpoint_type = "private"
      }
      
      resource "ibm_kms_key_alias" "test_alias" {
          instance_id = ibm_resource_instance.kms_instance.guid
          alias = "alias1"
          key_id = ibm_kms_key.test.key_id
      }
      
      
      Screenshot 2022-10-28 at 2 09 25 PM

Copy link

@dinesh-venkatraman-g dinesh-venkatraman-g left a comment

Choose a reason for hiding this comment

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

looks good. thanks for detailed test evidences @Sidd-kp

@hkantare hkantare merged commit b349b94 into IBM-Cloud:master Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants