Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Terraform And SQL Fundamentals
00:00
5 left

Terraform And SQL Fundamentals

HardSQL · PostgreSQL

Problem

Explain how you use Terraform to manage infrastructure and how you think about core SQL concepts like INNER JOIN, self join, unique keys, and traces/observability.

Using the supplied Terraform resource and observability trace tables, write a query that audits production resources managed by Terraform. Include only resources with qualifying traces, while preserving parent-resource information when available.

Output

  1. One row per qualifying resource with resource_key, resource_name, parent_resource_name, trace_count, failed_trace_count, and avg_duration_ms
  2. Include traces observed on or after 2026-01-01
  3. Order by resource_key ascending

Schema

terraform_resources
ColumnTypeDescription
resource_idPKINTInternal resource identifier
resource_keyVARCHAR(120)Stable unique Terraform resource key
resource_nameVARCHAR(120)Human-readable resource name
resource_typeVARCHAR(80)Terraform provider resource type
environmentVARCHAR(30)Deployment environment
managed_byVARCHAR(30)Infrastructure management system
parent_resource_idINTOptional self-referencing parent resource
observability_traces
ColumnTypeDescription
trace_idPKINTTrace record identifier
resource_idINTResource associated with the trace
statusVARCHAR(20)Trace outcome
duration_msDECIMAL(10,2)Trace duration in milliseconds
observed_atDATETrace observation date
Tablesterraform_resourcesobservability_traces
Interviewer

Your question is Terraform And SQL Fundamentals. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.