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

[BUG] Service Endpoint creationg fails with Disk Encryption error #647

Closed
nishantnasa opened this issue Feb 28, 2025 · 2 comments
Closed

Comments

@nishantnasa
Copy link

Describe the bug
When creating a service endpiont using apigeecli it fails with disk encryption error and the same request works fine using apigee api curl command

The command in question:

apigeecli endpoints create \
  --org "{ord}" \
 --token $TOKEN  \
--name test-psc-endpoint \
--location australia-souteast1 \
-s "projects/PROJECT_ID/regions/australia-southeast1/serviceAttachments/SA_NAME"

Error: disk encryption key must be of the format projects/{project-id}/regions/{location}/serviceAttachments/{sa-name}

The following curl command works fine and successfuly creates the endpoint attachment for PSC consumer:

curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type:application/json" \
"https://apigee.googleapis.com/v1/organizations/ORGANIZATION/endpointAttachments?endpointAttachmentId=EA_NAME" \
-d '{
    "location": "australia-southeast1",
    "serviceAttachment": "projects/PROJECT_ID/regions/australia-southeast1/serviceAttachments/SA_NAME"
}'

Version
apigeecli version 2.9.0 date: 2025-01-22T22:34:55Z [commit: 4d20467]

To Reproduce
Create a PSC Service Attachment in Producer project first and use the corresponding service attachment details in the following command to create the apigeex endpoint attachment for the PSC consumer

apigeecli endpoints create \
  --org "{ord}" \
 --token $TOKEN  \
--name test-psc-endpoint \
--location australia-souteast1 \
 --region australia-southeast1 \
-s "projects/PROJECT_ID/regions/australia-southeast1/serviceAttachments/SA_NAME"

Expected behavior
Endpoint attachment should be created successfully without any errors within ApigeeX

Additional context

@kurtkanaskie
Copy link
Collaborator

Thanks for creating this bug, I was able to verify and determine the root cause:

In the lines below is using the wrong parameter location

		ok := re.Match([]byte(location))
		if !ok {
			return fmt.Errorf("disk encryption key must be of the format " +
				"projects/{project-id}/regions/{location}/serviceAttachments/{sa-name}")
		}

It should be serviceAttachment:

                 ok := re.Match([]byte(serviceAttachment))
		if !ok {
			return fmt.Errorf("serviceAttachment must be of the format " +
				"projects/{project-id}/regions/{location}/serviceAttachments/{sa-name}")
		}

ssvaidyanathan added a commit that referenced this issue Feb 28, 2025
bug: #647 fixed validation of service-attachment flag
@ssvaidyanathan
Copy link
Collaborator

@nishantnasa - fixed and released in v2.9.1

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

No branches or pull requests

3 participants