Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Доступны в регионе
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • ИИ для бизнеса
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Партнёрская программа
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • iam_oauth_client
          • iam_service_account
          • iam_service_account_api_key
          • iam_service_account_iam_binding
          • iam_service_account_iam_member
          • iam_service_account_iam_policy
          • iam_service_account_key
          • iam_service_account_static_access_key
          • iam_workload_identity_federated_credential
          • iam_workload_identity_oidc_federation
          • iam_workload_identity_oidc_federation_iam_binding

В этой статье:

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for timeouts
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Identity and Access Management (IAM)
  4. Resources
  5. iam_service_account_iam_policy

yandex_iam_service_account_iam_policy (Resource)

Статья создана
Yandex Cloud
Обновлена 11 сентября 2025 г.
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for timeouts
  • Import

IAM policy for a service account
When managing IAM roles, you can treat a service account either as a resource or as an identity. This resource is used to add IAM policy bindings to a service account resource to configure permissions that define who can edit the service account.

There are three different resources that help you manage your IAM policy for a service account. Each of these resources is used for a different use case:

  • yandex_iam_service_account_iam_policy: Authoritative. Sets the IAM policy for the service account and replaces any existing policy already attached.
  • yandex_iam_service_account_iam_binding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service account are preserved.
  • yandex_iam_service_account_iam_member: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role of the service account are preserved.

Важно

yandex_iam_service_account_iam_policy cannot be used in conjunction with yandex_iam_service_account_iam_binding and yandex_iam_service_account_iam_member or they will conflict over what your policy should be.

Важно

yandex_iam_service_account_iam_binding resources can be used in conjunction with yandex_iam_service_account_iam_member resources only if they do not grant privileges to the same role.

Example usageExample usage

//
// Create a new IAM Service Account IAM Policy.
//
data "yandex_iam_policy" "admin" {
  binding {
    role = "admin"

    members = [
      "userAccount:foobar_user_id",
    ]
  }
}

resource "yandex_iam_service_account_iam_policy" "admin-account-iam" {
  service_account_id = "aje5a**********qspd3"
  policy_data        = data.yandex_iam_policy.admin.policy_data
}

SchemaSchema

RequiredRequired

  • policy_data (String) Required only by yandex_iam_service_account_iam_policy. The policy data generated by a yandex_iam_policy data source.
  • service_account_id (String) The service account ID to apply a binding to.

OptionalOptional

  • timeouts (Block, Optional) (see below for nested schema)

Read-OnlyRead-Only

  • id (String) The ID of this resource.

Nested Schema for Nested Schema for timeouts

Optional:

  • default (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

ImportImport

The resource can be imported by using their resource ID. For getting the resource ID you can use Yandex Cloud Web Console or YC CLI.

# terraform import yandex_iam_service_account_iam_policy.<resource Name> <resource Id>
terraform import yandex_iam_service_account_iam_policy.admin-account-iam aje5a**********qspd3

Была ли статья полезна?

Предыдущая
iam_service_account_iam_member
Следующая
iam_service_account_key
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»