Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources should return an error when an unsupported argument is supplied #90

Open
morey-tech opened this issue Aug 8, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@morey-tech
Copy link
Contributor

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.
@morey-tech morey-tech added the enhancement New feature or request label Aug 8, 2023
@jiachengxu
Copy link
Member

jiachengxu commented Aug 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants