pulumi-debug-failed-operation

작성자: pulumi

실패한 Pulumi 업데이트 또는 프리뷰를 디버그합니다: Pulumi가 이미 기록한 실패를 읽고, 원인을 찾아 수정합니다. 사용자가 요청하면 이 스킬을 로드합니다…

npx skills add https://github.com/pulumi/agent-skills --skill pulumi-debug-failed-operation

Debug a failed Pulumi operation

A Pulumi operation has failed. Find what caused it and fix it. The user usually points you at it, so start by working out which operation to debug, and confirm it with the user before doing anything else. Pulumi recorded the error when the operation failed, so once you know which operation it is you can read the error from that record without running anything again.

The commands below reach Pulumi Cloud with pulumi api, a subcommand of the Pulumi CLI that you run in your shell. Each one targets a stack by the explicit {orgName}/{projectName}/{stackName} path you pass it, so you do not need that stack selected locally to read its record. Selecting the stack matters later, when you go to apply a fix.

Start from the operation the user gave you

The user usually supplies the operation as a set of fields: the org, project, stack, and update version (or preview id) — most often stated in prose, for example "debug update 161 of vvm-dev". You need these to address the API: {orgName}, {projectName}, {stackName}, and the version or preview id.

Fill any missing field from context. Take the org, project, or stack from the currently selected stack (pulumi stack --show-name, pulumi stack ls) or Pulumi.yaml. A missing version means the most recent update on that stack.

Briefly confirm which operation you landed on, its version or preview id and the stack, before reading further. Keep it lightweight; they already told you.

Read what failed

A failed update and a failed preview both record engine events, and the error is in the diagnostic messages inside those events. Using the fields you settled on above, fetch the events and pull the messages out.

For a failed update, use the update path with the version number:

pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/update/<version>/events \
  | jq -r '.events[].diagnosticEvent | select(. != null) | "[\(.severity)] \(.message)"' \
  | sed 's/<{%reset%}>//g'

For a failed preview, use the preview path with the preview id:

pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/preview/<preview-id>/events \
  | jq -r '.events[].diagnosticEvent | select(. != null) | "[\(.severity)] \(.message)"' \
  | sed 's/<{%reset%}>//g'

Read every message, not only the ones tagged severity == "error". A provider error carries that error tag, but a program error, which is the common case when a preview fails, arrives as a stderr diagnostic tagged info#err. The trailing sed strips terminal color codes that Pulumi embeds in the text, which otherwise show up as <{%reset%}>.

Find the cause and where the fix belongs

An operation can fail with errors from more than one resource, so read all of the diagnostics first, then work through each error. Trace every error back to the resource that raised it (its URN and type), to where that resource is declared in the program, and to the inputs that feed it.

The error text tells you what kind of problem it is, and that points to where the fix belongs. A Pulumi fix lands in one of three places, and naming the right one keeps you from editing code that was never the problem.

  • The program. The code is wrong: a bad reference, a wrong type, an input the provider rejected, or a value used before it had resolved. This is what a failed preview usually reports, because the plan could not be built. Fix it by editing the code.
  • The state. The code is correct, but the stored state and the real cloud resources disagree. Reconcile drift with pulumi refresh, and bring a resource that already exists outside the state under management with pulumi import rather than recreating it. Note that an operation which failed partway through applying may have already changed some resources, so check the current state before you decide.
  • The environment. The problem is outside Pulumi: credentials, permissions, OIDC, or a quota. Fix the role, the ESC environment, or the capacity that the provider rejected, rather than the resource code.

Fix the cause

Make the smallest change that addresses the root cause. How you confirm the fix, and how you deliver it, whether as a local edit or as a pull request, follow your mode's workflow, not this skill.

If the user didn't say which operation

When the user gives you nothing to go on, debug their most recent operation on the stack. The update list does not record who ran each update, so find it through the API:

  1. Run pulumi whoami to get the current user's login.
  2. Read the latest update and who requested it with pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/updates/latest, and compare its requestedBy.githubLogin to the login from step 1.
  3. If they match, that update is the one to debug. If they do not, walk back one version at a time with pulumi api /api/stacks/{orgName}/{projectName}/{stackName}/updates/<n> until requestedBy.githubLogin matches the user.

Tell the user which operation you landed on, its version, kind, and result, and confirm it is the one they mean before going further.

pulumi의 다른 스킬

package-usage
pulumi
Pulumi 조직 내 여러 스택에서 특정 패키지를 어떤 버전으로 사용하는지 추적합니다. 스택 간 감사, 오래되었거나 유지 관리되지 않는 패키지 식별에 사용됩니다.
official
pulumi-automation-api
pulumi
Pulumi 인프라 운영을 여러 스택과 애플리케이션에 걸쳐 프로그래밍 방식으로 조정합니다. 로컬 소스(기존 Pulumi 프로젝트)와 인라인 소스(내장 프로그램) 아키텍처를 모두 지원하여 단순한 시나리오부터 복잡한 다중 스택 시나리오까지 유연한 배포 패턴을 가능하게 합니다. 종속성 순서 지정, 병렬 독립 배포, 조정된 인프라 프로비저닝을 위한 스택 간 출력 전달을 통해 다중 스택 조정을 처리합니다. 프로그래밍 방식의...
official
pulumi-best-practices
pulumi
신뢰할 수 있고 유지보수 가능한 Pulumi 인프라 코드를 작성하기 위한 종합적인 모범 사례. apply() 콜백 내에서 리소스를 생성하지 말고, Output 객체를 입력으로 직접 전달하여 종속성 추적 및 미리보기 가시성을 유지하세요. ComponentResource 클래스를 사용하여 관련 리소스를 재사용 가능한 논리적 단위로 그룹화하고, parent: this를 통해 적절한 부모-자식 계층 구조를 설정하세요. --secret 플래그 또는 config.requireSecret()를 사용하여 처음부터 비밀을 암호화하고, 상태 파일에서 자격 증명 유출을 방지하세요...
official
pulumi-component
pulumi
재사용 가능한 인프라 구성 요소로, 다중 언어 지원, 합리적인 기본값, 구성 패턴을 제공합니다. 네 가지 핵심 요소가 필요합니다: ComponentResource 확장, 표준 매개변수 수락, 모든 자식에 parent: this 설정, 생성자 끝에서 registerOutputs() 호출. Args 인터페이스는 Input<T> 래퍼를 사용해야 하며, 유니온 타입과 함수를 피하고, 다중 언어 SDK 생성을 지원하기 위해 구조를 평탄하게 유지해야 합니다. 필수 출력만 공용 속성으로 노출하고, 나머지는 숨깁니다.
official
pulumi-esc
pulumi
중앙 집중식 비밀, 구성 및 동적 자격 증명 관리를 제공하여 Pulumi 인프라와 애플리케이션을 지원합니다. 가져오기 및 계층화를 통한 환경 구성을 지원하며, environmentVariables, pulumiConfig 및 files에 대한 예약 키가 있습니다. AWS, Azure, GCP용 OIDC를 통해 단기 자격 증명을 생성하며, AWS Secrets Manager, Azure Key Vault, HashiCorp Vault 및 1Password와 통합됩니다. 핵심 CLI 명령어로는 pulumi env init, pulumi env edit, pulumi env open(공개...)이 있습니다.
official
pulumi-neo-handoff
pulumi
현재 스레드를 새로운 Pulumi Neo 작업으로 단방향 전송합니다. 사용자가 명시적으로 핸드오프, 전송, 이관 또는 현재 작업의 계속을 요청할 때 사용하세요.
official
pulumi-overview
pulumi
이 스킬은 일회성 CLI 작업부터 전체…에 이르기까지 클라우드 인프라 또는 SaaS 구성을 생성, 수정, 검사, 삭제하는 모든 작업에 사용하십시오.
official
pulumi-terraform-to-pulumi
pulumi
Terraform/OpenTofu 프로젝트를 Pulumi로 마이그레이션하며, HCL 소스 코드 변환 및/또는 Terraform 상태를 Pulumi 스택으로 가져오는 작업을 포함합니다. 사용자가...
official