搜索

PythonReactSEOPDF
GitHub Skill

debug-resource

Debug and troubleshoot Terraform resource issues

datarobot-community☆ 4 仓库 Stars3 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Debug Terraform Resource

This skill helps debug issues with Terraform resources in the DataRobot provider.

Common Issues

1. Resource Not Found After Create
  • Check if the API returns the correct ID
  • Verify the ID is stored in state: data.ID = types.StringValue(response.ID)
  • Look for client.NotFoundError handling in Read
2. State Drift
  • Ensure Read populates all computed fields
  • Check for fields that should use UseStateForUnknown() plan modifier
  • Verify Optional fields handle empty vs null correctly
3. Update Not Working
  • Check if field has RequiresReplace() modifier (forces new resource)
  • Verify Update sends only changed fields to API
  • Look for proper error handling in Update
4. Import Fails
  • Ensure ImportState uses resource.ImportStatePassthroughID
  • Verify Read can reconstruct full state from just the ID

Debug Commands

# Enable Terraform debug logging
export TF_LOG=DEBUG
export TF_LOG_PATH=./terraform.log

# Run with trace API calls
export TF_LOG_PROVIDER=TRACE

# Test specific resource
go test -v ./pkg/provider -run TestAcc{ResourceName} -timeout 30m

Useful Patterns

// Add debug tracing
traceAPICall("CreateResourceName")

// Check for not found errors
if _, ok := err.(*client.NotFoundError); ok {
    resp.State.RemoveResource(ctx)
    return
}

// Add diagnostic details
resp.Diagnostics.AddError(
    "Error creating resource",
    fmt.Sprintf("Could not create: %s", err.Error()),
)

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!