---
title: 'Ресурс selectel_iam_saml_federation_group_mappings_v1'
sidebar_label: 'selectel_iam_saml_federation_group_mappings_v1'
description: 'Creates and manages SAML Federation group mappings for Selectel products using public API v1'
sidebar_position: 25
---

# Ресурс selectel\_iam\_saml\_federation\_group\_mappings\_v1

:::info

Эта инструкция — копия документации Selectel Terraform-провайдера в [Terraform Registry](https://registry.terraform.io/providers/selectel/selectel/latest/docs).

:::

Manages SAML federation group mappings for Selectel products using public API v1.
Selectel products support Identity and Access Management (IAM).
For more information about group mappings, see the [official Selectel documentation](/access-control/groups/mapping/).

## Example Usage \{#example-usage}

```hcl
resource "selectel_iam_group_v1" "group_1" {
  name = "example-group"

  role {
    role_name = "reader"
    scope     = "account"
  }
}

resource "selectel_iam_saml_federation_v1" "federation_1" {
  name                  = "Federation name"
  description           = "Federation description"
  issuer                = "https://idp.example.com/realms/master"
  sso_url               = "https://idp.example.com/realms/master/protocol/saml"
  session_max_age_hours = 24
}

resource "selectel_iam_saml_federation_group_mappings_v1" "group_mappings_1" {
  federation_id = selectel_iam_saml_federation_v1.federation_1.id

  group_mapping {
    internal_group_id = selectel_iam_group_v1.group_1.id
    external_group_id = "external-group-1"
  }
}
```

## Argument Reference \{#argument-reference}

* `federation_id` - (Required) Federation ID to manage group mappings.

* `group_mapping` - (Required) Defines mappings between internal IAM groups and external identity provider groups. You can add multiple mappings – each mapping in a separate block.

  * `internal_group_id` - (Required) Internal IAM group ID.

  * `external_group_id` - (Required) External identity provider group ID.

## Attributes Reference \{#attributes-reference}

* `id` - Resource ID. Equals the `federation_id` value.

## Import \{#import}

You can import SAML Federation group mappings:

```shell
export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
terraform import selectel_iam_saml_federation_group_mappings_v1.group_mappings_1 <federation_id>
```

where:

* `<account_id>` — Selectel account ID. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). Learn more about [Registration](/account/registration/).

* `<username>` — Name of the service user. To get the name, in the [Control panel](https://my.selectel.ru/iam/service-users), go to **IAM** ⟶ the **Service users** tab ⟶ copy the name of the required user. Learn more about [Service Users](/access-control/user-types/).

* `<password>` — Password of the service user.

* `<federation_id>` — Unique identifier of the federation, for example, `abc1bb378ac84e1234b869b77aadd2ab`. To get the federation ID, in the [Control Panel](https://my.selectel.ru/iam/federations), go to **IAM** → **Federations** → copy the ID under the federation name.
