vultr-cli icon indicating copy to clipboard operation
vultr-cli copied to clipboard

[BUG] - Detaching VPC2 does not work, api issue?

Open resmo opened this issue 3 months ago • 6 comments

Describe the bug Detaching VPC2 does not work, even though the commands was successful (might be an api issue):

I tried several ways:

  • updating instance with curl with param detach_vpc2
  • vultr cli vultr-cli instance vpc2 detach ...

To Reproduce Steps to reproduce the behavior:

  1. list vpc2
$ vultr-cli vpc2 list                                                                                     
ID                                      DATE CREATED                    REGION  DESCRIPTION     IP BLOCK        PREFIX LENGTH
2b895409-fe58-4787-9499-2b1688aa0f3b    2024-03-10T06:03:37-04:00       ewr     test-vpc        10.99.0.0       24
bab5bef9-aac3-45bd-b032-a6a69e51f184    2024-03-10T06:03:50-04:00       ewr     test2-vpc       10.98.0.0       24
  1. create an instance with vpc2 attached:
$ curl "https://api.vultr.com/v2/instances" \
  -X POST \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{
    "region" : "ewr",
    "plan" : "vc2-1c-1gb",
    "label" : "Example Instance",
    "os_id" : 2136,
    "attach_vcp2": [
        "2b895409-fe58-4787-9499-2b1688aa0f3b",
        "bab5bef9-aac3-45bd-b032-a6a69e51f184"
    ]
  }'

check

$ vultr-cli instance vpc2 list d2cdeef9-ed7f-4d15-9da3-9284c2aa7345                                       
ID                                      MAC ADDRESS             IP ADDRESS
2b895409-fe58-4787-9499-2b1688aa0f3b    5a:01:04:ce:07:ab       10.99.0.3
bab5bef9-aac3-45bd-b032-a6a69e51f184    5a:02:04:ce:07:ab       10.98.0.3
  1. detach vpc2
$ vultr-cli instance vpc2 detach d2cdeef9-ed7f-4d15-9da3-9284c2aa7345 2b895409-fe58-4787-9499-2b1688aa0f3b
MESSAGE
VPC2 detached from instance
  1. check vpc2s for instance, still 2 vpc2 attached...
$ vultr-cli instance vpc2 list d2cdeef9-ed7f-4d15-9da3-9284c2aa7345                                       
ID                                      MAC ADDRESS             IP ADDRESS
2b895409-fe58-4787-9499-2b1688aa0f3b    5a:01:04:ce:07:ab       10.99.0.3
bab5bef9-aac3-45bd-b032-a6a69e51f184    5a:02:04:ce:07:ab       10.98.0.3
  1. Try to detach via instance update
$ curl "https://api.vultr.com/v2/instances/d2cdeef9-ed7f-4d15-9da3-9284c2aa7345" \
  -X PATCH \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{
    "detach_vpc2": [
        "2b895409-fe58-4787-9499-2b1688aa0f3b"
    ]
  }'
{"instance":{"id":"d2cdeef9-ed7f-4d15-9da3-9284c2aa7345","os":"Debian 12 x64","ram":1024,"disk":0,"main_ip":"144.202.9.203","vcpu_count":1,"region":"ewr","plan":"vc2-1c-1gb","date_created":"2024-03-10T06:17:08-04:00","status":"pending","allowed_bandwidth":1,"netmask_v4":"255.255.254.0","gateway_v4":"144.202.8.1","power_status":"running","server_status":"none","v6_network":"","v6_main_ip":"","v6_network_size":0,"label":"Example Instance","internal_ip":"","kvm":"","hostname":"vultr.guest","tag":"","tags":[],"os_id":2136,"app_id":0,"image_id":"","firewall_group_id":"","features":[],"user_scheme":"root"}}%
  1. check vpc2s for instance again, still 2 vpc2 attached...
$ vultr-cli instance vpc2 list d2cdeef9-ed7f-4d15-9da3-9284c2aa7345  
ID                                      MAC ADDRESS             IP ADDRESS
2b895409-fe58-4787-9499-2b1688aa0f3b    5a:01:04:ce:07:ab       10.99.0.3
bab5bef9-aac3-45bd-b032-a6a69e51f184    5a:02:04:ce:07:ab       10.98.0.3

Expected behavior

vpc2 detached

Additional context

also seeing this issue in ansible vultr collection https://github.com/vultr/ansible-collection-vultr/pull/118

$ vultr-cli version
Vultr-CLI v3.0.1

resmo avatar Mar 10 '24 10:03 resmo