---
title: How to Attach a Policy to a Role
url: https://docs.vultr.com/platform/iam/roles/how-to-attach-a-policy-to-a-role
description: Attach an IAM policy to a role on Vultr. Add permission rules to the role that are inherited by all users and groups assigned to it through the IAM system.
publish_date: 2026-03-24T19:52:34.971815Z
last_updated: 2026-06-01T21:29:24.263358Z
---

Attaching a policy to a role adds the policy's permission rules to the role. All users and groups assigned to the role automatically inherit the permissions defined in the attached policy.

Follow this guide to attach a policy to a role using the Vultr Console, the Vultr API, or Terraform.

=== "Vultr Console"

    1. Log in to the [Vultr Console](https://console.vultr.com).
    1. Click the organization name in the top navigation bar.
    1. Click **Manage Organization**.
    1. Click the **Roles** tab.
    1. Click the name of the role to which you want to attach a policy.
    1. In the **Permission Policies** section, click the **+** button.
    1. Search for and select the policies you want to attach.
    1. Click **Add Permission Policies**.

        The selected policies appear in the Permission Policies section.

=== "Vultr API"

    1. Send a `GET` request to the [**List Roles** endpoint](https://www.vultr.com/api/#tag/iam/operation/list-iam-roles) to retrieve all roles in your organization.

        ```console
        $ curl "https://api.vultr.com/v2/roles" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

        Note the `id` of the role to which you want to attach a policy.

    1. Send a `GET` request to the [**List Policies** endpoint](https://www.vultr.com/api/#tag/iam/operation/list-iam-policies) to retrieve all available policies.

        ```console
        $ curl "https://api.vultr.com/v2/policies" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

        Note the `id` of the policy you want to attach.

    1. Send a `POST` request to the [**Attach Policy to Role** endpoint](https://www.vultr.com/api/#tag/iam/operation/assign-iam-policy-to-role) to attach the policy. Replace `{role-id}` with the role id and `{policy-id}` with the policy id.

        ```console
        $ curl "https://api.vultr.com/v2/roles/{role-id}/policies/{policy-id}" \
            -X POST \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

        A successful request returns an HTTP `201 Created` response.

=== "Terraform"

    1. Ensure the [Vultr Terraform provider](https://registry.terraform.io/providers/vultr/vultr/latest/docs) is configured in your Terraform project.

    1. Define the role-policy attachment resource. Use Terraform references if the role and policy are managed in the same configuration, or replace with literal IDs.

        ```hcl
        resource "vultr_organization_role_policy_attachment" "role-policy-attachment" {
          role_id   = vultr_organization_role.my_role.id
          policy_id = vultr_organization_policy.my_policy.id
        }
        ```

    1. Apply the configuration.

        ```console
        $ terraform apply
        ```

        Verify that the output shows `vultr_organization_role_policy_attachment.role-policy-attachment: Creation complete`.