debug-resource
Debug and troubleshoot Terraform resource issues
Installation
Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.
Voir la source ↗GuidesInstructions
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.NotFoundErrorhandling 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
ImportStateusesresource.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()),
)
Exemples
Consultez les exemples du dépôt source.
Voir la source ↗Historique source
- Date d’indexation
- 2026-01-20
- Mise à jour de l’index
- 2026-01-26
- Branch
- main
Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!