Hi, I’m using the new terraform-plugin-framework and I’m running into an issue where if I make two inputs mutually exclusive with ExactlyOneOf, but one of them is passed at runtime from another resource block in terraform, it doesn’t error till it gets there during the apply, rather than at the planning stage.
in code, provider:
func (r *twoResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema {
Attributes: map[string]schema.Attribute {
"att_one": schema.Int64Attribute {
Optional: true,
Validators: []validator.Int64{
int64validator.ExactlyOneOf(path.Expressions{
path.MatchRoot("att_two"),
}...),
},
},
"att_two": schema.Int64Attribute {
Optional: true,
Validators: []validator.Int64{
int64validator.ExactlyOneOf(path.Expressions{
path.MatchRoot("att_one"),
}...),
},
},
},
}
}
main.tf:
resource "provider_resource1" "example" {
description = "This is an integration test"
name = "Test"
}
resource "provider_resource2" "example2" {
att_one = "${provider_resource1.example.id}" // this only breaks during apply, after creating provider_resource1
// att_one = 1 //this breaks on plan
att_two = 2
}
Is this the expected outcome? I can’t see why you’d want that to not be a planning error, even if you don’t know what the value is ahead of time.