-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Regression on terraform validate since version 0.15.2 #29093
Copy link
Copy link
Closed
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issueupstream
Description
The terraform validate command behavior seems to have changed since version 0.15.2 and do not fail anymore for unknown attributes in a dynamic block that depends from a variable.
Terraform Version
0.15.2 and above
Terraform Configuration Files
provider "azurerm" {
features {}
}
variable "test" {
type = bool
}
resource "azurerm_app_service_plan" "example" {
name = "test-plan"
location = "West Europe"
resource_group_name = "test-rg"
dynamic "sku" {
for_each = var.test ? ["_"] : []
content {
tier = "Standard"
size = "S1"
unknown_attribute = "foobar"
}
}
}
...Expected Behavior
Test with Terraform 0.15.1
$ terraform version
Terraform v0.15.1
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.66.0
Your version of Terraform is out of date! The latest version
is 1.0.1. You can update by downloading from https://www.terraform.io/downloads.html
$ terraform validate
╷
│ Error: Unsupported argument
│
│ on test2.tf line 21, in resource "azurerm_app_service_plan" "example":
│ 21: unknown_attribute = "foobar"
│
│ An argument named "unknown_attribute" is not expected here.
╵
Actual Behavior
Test with Terraform 0.15.2
$ terraform version
Terraform v0.15.2
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.66.0
Your version of Terraform is out of date! The latest version
is 1.0.1. You can update by downloading from https://www.terraform.io/downloads.html
$ terraform validate
Success! The configuration is valid.
Same with Terraform 1.0.1
$ terraform version
Terraform v1.0.1
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.66.0
$ terraform validate
Success! The configuration is valid.
Steps to Reproduce
1. `terraform init`
2. `terraform validate`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issueupstream