Skip to content

Bug: CustomType nested attributes silently ignore unknown attributes #74

@hanneshayashi

Description

@hanneshayashi

Summary

Unknown/invalid attributes in nested blocks using CustomType are silently ignored instead of being rejected with an error.

Reproduction

resource "doit_alert" "test" {
  name = "test-alert"
  config = {
    metric = {
      type              = "basic"
      value             = "cost"
      this_is_invalid   = "should_fail"  # Should cause an error!
    }
    time_interval = "month"
    value         = 1000
    currency      = "USD"
    condition     = "value"
    operator      = "gt"
  }
}

Expected Behavior

terraform plan should fail with "Unsupported argument" error.

Actual Behavior

terraform plan succeeds. The invalid attribute is silently discarded.

Root Cause

The schema uses CustomType: MetricType{} for nested blocks. While MetricValue.AttributeTypes() only defines specific attributes, the Terraform Plugin Framework does not reject extra attributes when using custom types.

Affected Resources

All resources with nested blocks using CustomType: doit_alert, doit_budget, doit_allocation, doit_report

References

  • Test configuration: .test/schema-validation-test/main.tf
  • Schema definition: internal/provider/resource_alert/alert_resource_gen.go:84-105

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions