Hi,
I am trying to create spanner instance using TF resource and also wanted to check the input variable before creating and for that I am using “precondition” in lifecycle with resource “google_spanner_instance”, but it’s giving below error.
│ Error: Unsupported block type
“google_spanner_instance” “test”:
precondition {
Blocks of type “precondition” are not expected here.
PFB the code used.
resource “google_spanner_instance” “test” {
config = “nam-eur-asia1”
display_name = “Multi Regional Instance”
num_nodes = var.num_nodes
labels = {
“foo” = “bar”
}
project = “ad-test-inv-acc-lvl”
lifecycle {
precondition {
condition = var.num_nodes>=1
error_message = “Nodes cannot be more than 1”
}
}
}
Is there any other way to validate the input variable to the TF resource?
Help appreciated.
Thanks,
Amarnath.