"Try" function not supported in v0.12.6
saurabh24292 opened this issue · 3 comments
saurabh24292 commented
Terraform Version
v0.12.6
Terraform Configuration Files
Below is what we have in the main.tf:
locals {
seed_project_id = format("%s-%s", var.project_prefix, "seed")
impersonation_apis = distinct(concat(var.activate_apis, ["serviceusage.googleapis.com", "iamcredentials.googleapis.com"]))
impersonation_enabled_count = var.sa_enable_impersonation == true ? 1 : 0
activate_apis = var.sa_enable_impersonation == true ? local.impersonation_apis : var.activate_apis
org_project_creators = distinct(concat(var.org_project_creators, ["serviceAccount:${google_service_account.org_terraform.email}", "group:${var.group_org_admins}"]))
is_organization = var.parent_folder == "" ? true : false
parent_id = var.parent_folder == "" ? var.org_id : split("/", var.parent_folder)[1]
seed_org_depends_on = try(google_folder_iam_member.tmp_project_creator.0.etag, "") != "" ? var.org_id : google_organization_iam_member.tmp_project_creator.0.org_id
}
I am trying to use the terraform-example-foundation repo and running the bootstrap part.
Expected Behavior
It should have run without any errors.
Actual Behavior
Error: Call to unknown function
on .terraform/modules/seed_bootstrap/main.tf line 25, in locals:
25: seed_org_depends_on = try(google_folder_iam_member.tmp_project_creator.0.etag, "") != "" ? var.org_id : google_organization_iam_member.tmp_project_creator.0.org_id
There is no function named "try".
morgante commented
Can you try with the latest Terraform version (v0.12.28)?
bharathkkb commented
try
was added in 0.12.20
. We should update the required_version to ~>0.12.20
here and in example foundations.
saurabh24292 commented
Awesome. Would be a good to update the Readme too with the correct version.