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.
resource_key, resource_name, parent_resource_name, trace_count, failed_trace_count, and avg_duration_msresource_key ascending| Column | Type | Description |
|---|---|---|
| resource_idPK | INT | Internal resource identifier |
| resource_key | VARCHAR(120) | Stable unique Terraform resource key |
| resource_name | VARCHAR(120) | Human-readable resource name |
| resource_type | VARCHAR(80) | Terraform provider resource type |
| environment | VARCHAR(30) | Deployment environment |
| managed_by | VARCHAR(30) | Infrastructure management system |
| parent_resource_id | INT | Optional self-referencing parent resource |
| Column | Type | Description |
|---|---|---|
| trace_idPK | INT | Trace record identifier |
| resource_id | INT | Resource associated with the trace |
| status | VARCHAR(20) | Trace outcome |
| duration_ms | DECIMAL(10,2) | Trace duration in milliseconds |
| observed_at | DATE | Trace observation date |