Update an existing IAM role in your Vultr organization. Modify the role name, description, or type configuration through the Vultr API or the Console.
Updating a role allows you to change its name, description, type, or session duration. This is useful when you need to adjust access levels or rebrand a role to reflect its current purpose. You can also convert an assignable role to an assumable role or vice versa by changing the role_type field.
Follow this guide to update a role using the Vultr Console, the Vultr API, or Terraform.
Send a GET request to the List Roles endpoint to retrieve all roles in your organization.
$ curl "https://api.vultr.com/v2/roles" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the role you want to update.
Send a GET request to the Read Role endpoint to retrieve the current role details. Replace {role-id} with the id you retrieved in the previous step.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PUT request to the Update Role endpoint to update the role. Replace the values with your updated role details.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "NEW-ROLE-NAME",
"description": "NEW-ROLE-DESCRIPTION",
"role_type": "assignable",
"max_session_duration": 7200
}'
Send a GET request to the Read Role endpoint to retrieve the updated details.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Verify that the role details reflect the new values.
Ensure the Vultr Terraform provider is configured in your Terraform project.
Open the role resource configuration and modify the name, description, type, or max_session_duration field.
$ nano roles.tf
Apply the changes.
$ terraform apply
Verify that the output shows vultr_organization_role.my_role: Modifications complete.