Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Inaccurate diagnostics context for nested fields #93

Closed
radeksimko opened this issue Mar 4, 2019 · 2 comments
Closed

Inaccurate diagnostics context for nested fields #93

radeksimko opened this issue Mar 4, 2019 · 2 comments
Labels

Comments

@radeksimko
Copy link
Member

Terraform Version

369d512e22bf18fd810b8583e6914458abc569aa

Terraform Configuration Files

resource "azurerm_kubernetes_cluster" "aks_with_rbac" {
  name                = "something"
  location            = "test"
  resource_group_name = "tada"
  dns_prefix          = "radek"
  kubernetes_version  = "1.11"

  role_based_access_control {
    enabled = true
  }

  agent_pool_profile {}
  service_principal {
    client_id     = "00000000-0000-0000-0000-000000000000"
    client_secret = "00000000000000000000000000000000"
  }
}

Expected Behavior

Snippet of code pointing to the right LOC - i.e. to the definition of parent block which is missing arguments.

Actual Behavior

$ terraform plan
Error: Missing required argument

  on main.tf line 1, in resource "azurerm_kubernetes_cluster" "aks_with_rbac":
   1: resource "azurerm_kubernetes_cluster" "aks_with_rbac" {

The argument "name" is required, but no definition was found.


Error: Missing required argument

  on main.tf line 1, in resource "azurerm_kubernetes_cluster" "aks_with_rbac":
   1: resource "azurerm_kubernetes_cluster" "aks_with_rbac" {

The argument "vm_size" is required, but no definition was found.

Steps to Reproduce

$ terraform plan

Additional Context

As documented the arguments reported as missing are arguments nested under agent_pool_profile block, which is not obvious from the error output.

@apparentlymart
Copy link
Contributor

The language used in these errors looks like the language produced by HCL itself when asked to decode a block with a missing required argument, so I'm not sure if this is actually an SDK bug or an HCL bug. Will need to dig in some more to see what's missing here.

@apparentlymart
Copy link
Contributor

I've now seen this same behavior in a different program, so this seems to be a bug either in hcldec or in the lower-level body.Content method it is built on.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants