hashicorp / hashicorp/terraform-plugin-sdk
ExactlyOneOf internal validation errors for nested schemas don't help me solve the problem
- Dominant language
- Go
- Stars
- 485
- Forks
- 244
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 4
Description
### SDK version
```
{
"Path": "github.com/hashicorp/terraform-plugin-sdk/v2",
"Version": "v2.2.0"
}
```
### Relevant provider source code
```go
Schema: map[string]*schema.Schema{
"disk_container": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"url": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ExactlyOneOf: []string{"user_bucket", "url"},
},
"user_bucket": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
ExactlyOneOf: []string{"user_bucket", "url"},
MaxItems: 1,
...
```
### Terraform Configuration Files
n/a
### Debug Output
n/a
### Expected Behavior
The ExactlyOneOf requirement needs a "fully qualified" path to the value, and it should use the fully qualified path when describing the error:
```
Error: InternalValidate
Internal validation of the provider failed! This is always a bug
with the provider itself, and not a user issue. Please report
this bug:
1 error occurred:
* resource aws_ebs_snapshot_import: ExactlyOneOf: disk_container.*.url references unknown
attribute (user_bucket) at part (user_bucket)
```
### Actual Behavior
I get an error message indicating maybe I've typo'd a name, and the error message doesn't indicate it is a nesting issue:
```
Error: InternalValidate
Internal validation of the provider failed! This is always a bug
with the provider itself, and not a user issue. Please report
this bug:
1 error occurred:
* resource aws_ebs_snapshot_import: ExactlyOneOf: url references unknown
attribute (user_bucket) at part (user_bucket)
```
### Steps to Reproduce
1. Create a resource with a schema nested inside the schema
2. Use ExactlyOneOf to restrict the behavior of two fields inside the nested schema, using relative name references
In case it was hard to tell in the output, I'm hoping for:
```diff
-ExactlyOneOf: url references unknown
+ExactlyOneOf: disk_container.*.url references unknown
```
Contributor guide
Assessment
This issue has not been assessed yet.