Skip to content
Souf edited this page Jul 9, 2021 · 3 revisions

Introduction

In Anypoint platform, roles are permissions. There's a set of predefined roles that cannot be updated and from which you can pick and choose. You cannot create your own roles. Instead you can assign a role to a role group, in this case we talk about rolegroup-role.

Resource

Following are the supported parameters for creating a rolegroup-roles Resource:

Parameter Description Required Updatable
role_group_id  the role group you wish to add roles to  yes  no (forces new)
org_id the organization id yes no (forces new)
roles   the role you wish to assign to the role group, you can repeat the block as many times as you need (for each role assigned)  yes no (forces new) 
resource "anypoint_rolegroup_roles" "assignedRoles" {
  role_group_id = "YOUR_ROLE_GROUP_ID"
  org_id = "YOUR_ORG_ID"
  roles {
    role_id = "THE_ROLE_ID_TO_ASSIGN_1"
  }
  roles {
    role_id = "THE_ROLE_ID_TO_ASSIGN_2"
  }
  roles {
    role_id = "THE_ROLE_ID_TO_ASSIGN_3"
  }
  ...
}

Data Source

List of Roles data sources

anypoint_roles

To get a list of available Roles.

Following is a list of available parameters to use this data source:

Parameter Description
params block with search parameters. this block should be repeated only once. see below for details. This block is optional

Example

data "anypoint_roles" "roles" {
  params {
    name             = ""     // search by the name of a role
    description      = ""     // search by the description of a role 
    include_internal = ""     // to include internal roles in results
    search           = ""     // a search string to use for partial matches of role names
    offset           = 0      // pagination parameter to start returning results from this position of matches. default 0
    limit            = 150    // pagination parameter for how many results to return. default 200
    ascending        = true   // sort order for filtering. default true
  }
}

output "roles" {
  value = data.anypoint_roles.roles
}

Result

Outputs:

roles = {
  "id" = "1625824496"
  "len" = 3
  "params" = toset([
    {
      "ascending" = true
      "description" = ""
      "include_internal" = false
      "limit" = 200
      "name" = ""
      "offset" = 0
      "search" = "exchange"
    },
  ])
  "roles" = tolist([
    {
      "description" = "Gives permission to view, create, share, deprecate, delete, and download assets within a business group. Also gives permission to edit asset portal content for an existing asset version"
      "internal" = false
      "name" = "Exchange Administrator"
      "namespaces" = tolist([
        "exchange",
      ])
      "org_id" = ""
      "role_id" = "bc402b36-438d-430d-88c1-b2a14726a863"
      "shareable" = false
    },
    {
      "description" = "Gives permission to view, create, and download assets within a business group. Also gives permission to edit asset portal content in an existing asset version"
      "internal" = false
      "name" = "Exchange Contributor"
      "namespaces" = tolist([
        "exchange",
      ])
      "org_id" = ""
      "role_id" = "d5b3fd8a-abe9-48de-a4e1-01040ca99b2e"
      "shareable" = false
    },
    {
      "description" = "Gives permission to view and download assets within a business group"
      "internal" = false
      "name" = "Exchange Viewer"
      "namespaces" = tolist([
        "exchange",
      ])
      "org_id" = ""
      "role_id" = "98f87b9d-3e41-49cc-a171-f2580a742049"
      "shareable" = false
    },
  ])
  "total" = 3
}

Clone this wiki locally