yandex-cloud-terraform

skibitskiy's avatarfrom skibitskiy

Terraform IaC patterns for Yandex Cloud. Use when creating, modifying, or refactoring Terraform configurations for YDB, S3, Message Queue, Cloud Functions, API Gateway, or Serverless Containers. Provides resource patterns, naming conventions, and best practices from production projects.

0stars🔀0forks📁View on GitHub🕐Updated Jan 2, 2026

When & Why to Use This Skill

This Claude skill provides production-ready Terraform Infrastructure as Code (IaC) patterns specifically optimized for Yandex Cloud. It streamlines the deployment of serverless components—including YDB, Cloud Functions, and API Gateways—by providing validated resource patterns, naming conventions, and solutions to common architectural pitfalls.

Use Cases

  • Provisioning complex serverless architectures on Yandex Cloud using YDB, S3, and Cloud Functions with automated dependency management.
  • Refactoring existing Terraform configurations to implement standardized naming conventions and modular structures for multi-environment (dev/prod) consistency.
  • Configuring secure IAM role bindings and service accounts for Yandex Cloud resources following production-grade security best practices.
  • Troubleshooting and preventing common deployment errors, such as YDB schema concurrency issues and Docker platform compatibility for serverless containers.
nameyandex-cloud-terraform
descriptionTerraform IaC patterns for Yandex Cloud. Use when creating, modifying, or refactoring Terraform configurations for YDB, S3, Message Queue, Cloud Functions, API Gateway, or Serverless Containers. Provides resource patterns, naming conventions, and best practices from production projects.

Terraform Yandex Cloud

Quick Start

Choose Structure

Modular (environments/ + modules/): Multiple environments (dev/stage/prod), reusable components

Flat (functional files): Single environment, small-medium projects

Essential Patterns

# Resource naming with prefix
locals {
  resource_prefix = "${var.project_name}-${var.environment}"
}

# YDB tables require wait for database readiness
resource "time_sleep" "wait_for_database" {
  depends_on      = [yandex_ydb_database_serverless.this]
  create_duration = "30s"
}

# TTL on temporary data
ttl {
  column_name     = "expires_at"
  expire_interval = "PT0S"  # immediate
}

# Secondary index with concurrency guard
resource "yandex_ydb_table_index" "index2" {
  # ...
  depends_on = [yandex_ydb_table_index.index1]
}

Common Tasks

  • Add YDB table: See YDB.md for table patterns, TTL, indexes
  • Add Cloud Function: See FUNCTIONS.md for build+deploy patterns
  • Add Message Queue: See QUEUE.md for DLQ and retry patterns
  • Add Serverless Container: See CONTAINERS.md for Docker registry, triggers, sizing
  • IAM roles: See IAM.md for common role combinations

Key Pitfalls

  1. YDB tables fail without depends_on = [time_sleep.wait_for_database]
  2. Multiple indexes need sequential depends_on to avoid concurrent schema modifications
  3. TTL format: P5D = 5 days, PT0S = immediate
  4. Service accounts need explicit IAM role bindings
  5. Functions need user_hash for redeployment triggers
  6. Docker images MUST be built with --platform=linux/amd64 (ARM images fail with "Internal error")