mirror of https://github.com/hashicorp/terraform
This helps us catch diagnostics in locals that only happen during evaluation Co-authored-by: Mutahhir Hayat <mutahhir.hayat@hashicorp.com> Co-authored-by: Matej Risek <matej.risek@hashicorp.com>pull/37994/head
parent
39b07878bd
commit
7170c47b72
@ -0,0 +1,7 @@
|
||||
variable "name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
resource "testing_resource" "hello" {
|
||||
id = var.name
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
required_providers {
|
||||
testing = {
|
||||
source = "hashicorp/testing"
|
||||
version = "0.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
provider "testing" "main" {}
|
||||
|
||||
variable "in" {
|
||||
type = object({
|
||||
name = string
|
||||
})
|
||||
}
|
||||
|
||||
locals {
|
||||
# This is not caught during the config evaluation but only when we try to
|
||||
# evaluate this value during planning / applying.
|
||||
invalid_local = { for k, v in var.in : k => v + 3 }
|
||||
}
|
||||
|
||||
component "self" {
|
||||
source = "./"
|
||||
inputs = {
|
||||
name = "example#{local.invalid_local}"
|
||||
}
|
||||
|
||||
providers = {
|
||||
testing = provider.testing.main
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue