pulumi-terraform-to-pulumi

tarafından pulumi

Terraform/OpenTofu projelerini Pulumi'ye taşıyın; HCL kaynak kodunu çevirme ve/veya Terraform durumunu bir Pulumi yığınına aktarma dahil. Bir kullanıcı…

npx skills add https://github.com/pulumi/agent-skills --skill pulumi-terraform-to-pulumi

Migrating from Terraform to Pulumi

Critical constraints — read before acting:

  • Do NOT run pulumi convert — use the terraform-migrate plugin instead, which preserves state mapping.
  • Do NOT run pulumi package add terraform-module — this is for a different workflow.
  • Do NOT create the Pulumi project under /workspace — create it inside the checked-out repo.
  • Replace ${terraform_dir} and ${pulumi_dir} below with the actual paths confirmed with the user.

First establish scope and plan the migration by working out with the user:

  • where the Terraform sources are (${terraform_dir})
  • where the migrated Pulumi project lives (${pulumi_dir})
  • what is the target Pulumi language (such as TypeScript, Python, YAML)
  • whether migration aims to setup Pulumi stack states, or only translate source code

Confirm the plan with the user before proceeding.

Create a new Pulumi project in ${pulumi_dir} in the chosen language. Edit sources to be empty and not declare any resources. Ensure a Pulumi stack exists.

You must run pulumi_up tool before proceeding to ensure initial stack state is written.

If no local .tfstate file exists in ${terraform_dir}, the state may be in a remote backend (S3, Pulumi Cloud, Terraform Cloud, etc.). Pull it before proceeding:

cd ${terraform_dir} && terraform state pull > terraform.tfstate

This works for all backends, including Pulumi Cloud. If terraform is not available, try tofu state pull instead.

Now produce a draft Pulumi state translation:

pulumi plugin run terraform-migrate -- stack \
    --from ${terraform_dir} \
    --to ${pulumi_dir} \
    --out /tmp/pulumi-state.json \
    --plugins /tmp/required-providers.json

Do NOT install the plugin as it will auto-install as needed.

Sometimes terraform-migrate plugin fails because tofu refresh is not authorized. DO NOT skip this step. Work with the user to find or build a Pulumi ESC environment that provides the necessary credentials so the command can succeed. If setting up an ESC environment is not feasible, inform the user that the migration cannot proceed automatically.

Read the generated /tmp/required-providers.json and install all these Pulumi providers into the new project, respecting the suggested versions even if they downgrade an already installed provider. The file will contain records such as [{"name":"aws","version":"7.12.0"}].

Install providers as project dependencies using the language-specific package manager (NOT pulumi plugin install, which only downloads plugins without adding dependencies):

# TypeScript/JavaScript
npm install @pulumi/aws@7.12.0

# Python
pip install pulumi_aws==7.12.0

# Go
go get github.com/pulumi/pulumi-aws/sdk/v7@v7.12.0

# C#
dotnet add package Pulumi.Aws --version 7.12.0

Import the translated state draft (/tmp/pulumi-state.json) into the Pulumi stack:

pulumi stack import --file /tmp/pulumi-state.json

Translate source code to match both the Terraform source and the translated state. Aim for exact match. You can consult the state draft /tmp/pulumi-state.json for Pulumi resource types and names to use.

Iterate on fixing the source code until pulumi_preview tool confirms that there are no changes to make and the diff is empty or almost empty. Provider diffs or diffs on tags may be OK.

Offer the user to link an ESC environment to the stack so that each Pulumi stack can seamlessly have access to the provider credentials it needs.

When all looks good, create a Pull Request with the migrated source code.

pulumi tarafından daha fazla skill

package-usage
pulumi
Bir Pulumi organizasyonundaki yığınların hangi paketi ve hangi sürümlerde kullandığını takip edin. Yığınlar arası denetimler, güncel olmayan veya bakımı yapılmayanları belirlemek için kullanın…
official
pulumi-automation-api
pulumi
Pulumi altyapı işlemlerinin birden çok stack ve uygulama genelinde programlı orkestrasyonu. Hem yerel kaynak (mevcut Pulumi projeleri) hem de satır içi kaynak (gömülü programlar) mimarilerini destekleyerek basit senaryolardan karmaşık çoklu stack senaryolarına kadar esnek dağıtım modelleri sağlar. Bağımlılık sıralaması, paralel bağımsız dağıtımlar ve koordineli altyapı sağlama için stackler arası çıktı aktarımı ile çoklu stack orkestrasyonunu yönetir. Programlı...
official
pulumi-best-practices
pulumi
Güvenilir ve sürdürülebilir Pulumi altyapı kodu yazmak için kapsamlı en iyi uygulamalar. apply() geri çağrıları içinde kaynak oluşturmaktan kaçının; bağımlılık takibini ve önizleme görünürlüğünü korumak için Output nesnelerini doğrudan girdi olarak iletin. İlgili kaynakları parent: this ile uygun üst-alt hiyerarşisine sahip yeniden kullanılabilir mantıksal birimler halinde gruplamak için ComponentResource sınıflarını kullanın. Durum dosyalarında kimlik bilgisi sızıntısını önlemek için --secret bayrağı veya config.requireSecret() ile sırları en baştan şifreleyin...
official
pulumi-component
pulumi
Yeniden kullanılabilir altyapı bileşenleri, çoklu dil desteği, mantıklı varsayılanlar ve kompozisyon desenleri sunar. Dört temel öğe gerektirir: ComponentResource'u genişletmek, standart parametreleri kabul etmek, tüm alt öğelerde parent: this ayarlamak ve constructor Args arayüzlerinin sonunda registerOutputs() çağırmak Input<T> sarmalayıcılarını kullanmalı, birleşim türlerinden ve işlevlerden kaçınmalı ve çoklu dil SDK oluşturmayı desteklemek için yapıları düz tutmalıdır Yalnızca temel çıktıları genel özellikler olarak açığa çıkarın; gizleyin...
official
pulumi-debug-failed-operation
pulumi
Başarısız olan bir Pulumi güncellemesini veya önizlemesini hata ayıkla: Pulumi'nin zaten kaydettiği hatayı oku, neyin sebep olduğunu bul ve düzelt. Kullanıcı şunu istediğinde bu beceriyi yükle…
official
pulumi-esc
pulumi
Pulumi altyapısı ve uygulamaları için merkezi sırlar, yapılandırma ve dinamik kimlik bilgileri yönetimi. İçe aktarmalar ve katmanlama yoluyla ortam kompozisyonunu destekler; environmentVariables, pulumiConfig ve files için ayrılmış anahtarlar içerir. AWS, Azure ve GCP için OIDC aracılığıyla kısa süreli kimlik bilgileri oluşturur; AWS Secrets Manager, Azure Key Vault, HashiCorp Vault ve 1Password ile entegre olur. Temel CLI komutları arasında pulumi env init, pulumi env edit, pulumi env open (gösterir...) bulunur.
official
pulumi-neo-handoff
pulumi
Mevcut konuyu yeni bir Pulumi Neo görevine tek yönlü bir aktarım olarak devredin. Kullanıcı açıkça devretmek, göndermek, aktarmak veya mevcut konuyu sürdürmek istediğinde kullanın…
official
pulumi-overview
pulumi
Bulut altyapısı veya SaaS yapılandırması oluşturan, değiştiren, inceleyen veya yok eden herhangi bir görev için bu beceriyi kullanın; tek seferlik CLI işlemlerinden tam…
official