/terraform-yc-cloud

YC Cloud bootstrap

Primary LanguageHCLMIT LicenseMIT

Cloud bootstrap Terraform module for Yandex.Cloud

prerequisites

Use Yandex-id account with roles:

  • billing.accounts.editor or higher to attach cloud to billing account
  • resource-manager.admin on organization level to create cloud and folders
  • organization-manager.admin to create groups

Features

  • Create a cloud or use an existing one
  • Сreate cloud folders
  • Сreate organization groups
  • Add users to organization groups
  • Assign cloud permissions to a group
  • Assign folders permissions to a group

How to configure Terraform to use a module

  • Install YC CLI
  • Add environment variables for terraform auth in Yandex.Cloud
export YC_TOKEN=$(yc iam create-token)

Examples

See examples section

Requirements

Name Version
terraform >= 1.3.0
time 0.9.1
yandex 0.93

Providers

Name Version
time 0.9.1
yandex 0.93.0

Modules

No modules.

Resources

Name Type
time_sleep.this resource
yandex_billing_cloud_binding.this resource
yandex_organizationmanager_group.this resource
yandex_organizationmanager_group_membership.this resource
yandex_resourcemanager_cloud.this resource
yandex_resourcemanager_cloud_iam_member.this resource
yandex_resourcemanager_folder.this resource
yandex_resourcemanager_folder_iam_member.this resource
yandex_resourcemanager_cloud.this data source

Inputs

Name Description Type Default Required
billing_account_id (Required) ID of billing account to bind Cloud to.
For more information see https://cloud.yandex.com/en/docs/billing/concepts/billing-account.
string null no
cloud (Required) Configuration of the Cloud.
For more information see https://cloud.yandex.com/en/docs/resource-manager/concepts/resources-hierarchy#cloud.

Configuration attributes:
existing_cloud_id - (Required, unless using name) Allows to specify an existing Cloud ID. Conflicts with name.
name - (Required, unless using existing_cloud_id) The name of the Cloud. Conflicts with existing_cloud_id.
description - (Optional) Description of the Cloud.
labels - (Optional) A set of key/value label pairs to assign to the Cloud.

At least one of existing_cloud_id, name must be specified.
object({
existing_cloud_id = optional(string)
name = optional(string)
description = optional(string)
labels = optional(map(string))
})
{} no
delay_after_cloud_create Set a delay before creating folders after cloud creation.
Temporary workaround until the issue of cloud creation by the Terraform provider is resolved.
string "60s" no
folders (Optional) List of objects of the Cloud Folders.
For more information see https://cloud.yandex.com/en/docs/resource-manager/concepts/resources-hierarchy#folder

Configuration attributes:
name - (Required) The name of the Folder.
description - (Optional) A description of the Folder.
labels - (Optional) A set of key/value label pairs to assign to the Folder.
list(object({
name = string
description = optional(string)
labels = optional(map(string))
}))
[] no
groups (Optional) List of objects of the Organization Groups.
For more information see https://cloud.yandex.com/en/docs/organization/manage-groups.

Configuration attributes:
name - (Required) The name of the group. Must be unique in each object.
description - (Optional) A description of the group.
members - (Optional) List of group members.
cloud_roles - (Optional) List of cloud roles for the group.
folder_roles - (Optional) List of objects with folder name and group roles for this folder.

Objects in the folder_roles supports the following attributes:
folder_name - (Required) The name of the folder.
roles - (Optional) List of roles for the group.
list(object({
name = string
description = optional(string)
members = optional(set(string), [])
cloud_roles = optional(set(string), [])
folder_roles = optional(list(object({
folder_name = string
roles = set(string)
})), [])
}))
[] no
organization_id (Required) Yandex.Cloud Organization that the Cloud belongs to. If value is omitted, the default provider Organization ID is used.
For more information see https://cloud.yandex.com/en/docs/organization/
string null no

Outputs

Name Description
cloud_id ID of the Cloud.
cloud_name The name of the Cloud.
folders The name of the Сloud folders.
groups The name of the groups.