Resources should return an error when an unsupported argument is supplied
morey-tech opened this issue · comments
Nicholas Morey commented
To make obvious user errors like the one in #89, resources should return an error when an unsupported argument is supplied.
Here's an example of adding an unsupported argument to the google_client_config
resource:
│ Error: Unsupported argument
│
│ on gcp-gke.tf line 58, in data "google_client_config" "current":
│ 58: test = "my-data"
│
│ An argument named "test" is not expected here.
Jiacheng Xu commented
This seems like a common issue from upstream: hashicorp/terraform#33570
that the nested attributes are not validated during conversions.
I verified that other attributes (not nested attributes), for example in cluster resource:
resource "akp_cluster" "example2" {
instance_id = akp_instance.argocd.id
name = "test2"
unknown = "I am unknown" <- unsupported argument
namespace = "akuity"
labels = {
label_1 = "example-label"
}
annotations = {
ann_1 = "example-annotation"
}
spec = {
namespace_scoped2 = "true" <- unsupported argument, it should be namespace_scoped
description = "test"
data = {
size = "small"
auto_upgrade_disabled = "false"
}
}
}
fails with:
│ Error: Unsupported argument
│
│ on main.tf line 65, in resource "akp_cluster" "example2":
│ 65: unknown = "I am unknown"
│
│ An argument named "unknown" is not expected here.
but because the spec
is nested attributes, so it doesn't fail with conversions.