Search code examples
google-cloud-platformgcloudgoogle-secret-manager

latest alias doesn't work with gcloud secrets versions destroy


According to the documentation, gcloud secrets versions destroy can be invoked with the latest alias:

gcloud secrets versions destroy latest --secret my-secret

But when I do this, I get

ERROR: (gcloud.secrets.versions.destroy) INVALID_ARGUMENT: Resource ID [projects/XXXXX/secrets/my-secretversions/latest] is not in a valid format.

If I do

gcloud secrets versions describe latest --secret my-secret

I get a valid secret returned.

Is the documentation just wrong for the destroy command, or am I missing something?


Solution

  • I understand that the latest alias is giving the following error:

    ERROR: (gcloud.secrets.versions.destroy) INVALID_ARGUMENT: Resource ID [projects/XXXXX/secrets/my-secretversions/latest] is not in a valid format.
    

    when trying to destroy a secret using gcloud command line:

    gcloud secrets versions destroy latest --secret my-secret
    
    

    This was a Documentation bug and it has been updated. You can't use latest alias to delete a Secret, you will need to specify it's version to delete it.

    gcloud secrets versions destroy VERSION --secret=my-secret
    
    

    For future, if you see any bug or not intended behavior, please click on Send Feedback button of the documentation or create a Public Issue Tracker request to investigate further and track the bug.