Skip to content

Commit 2f8abeb

Browse files
committed
fix(workload-identity): resolve inconsistent conditional result types in output
When use_existing_gcp_sa is unknown at plan time, Terraform fails with "Inconsistent conditional result types" because the data source and resource have slightly different object schemas. Replace the ternary with one(concat(...)) so Terraform never needs to type-check across the two branches — only one list ever has elements based on their mutually exclusive count conditions. Fixes #1112
1 parent 94bdc6a commit 2f8abeb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

modules/workload-identity/output.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ output "gcp_service_account_name" {
4141

4242
output "gcp_service_account" {
4343
description = "GCP service account."
44-
value = var.use_existing_gcp_sa ? data.google_service_account.cluster_service_account[0] : google_service_account.cluster_service_account[0]
44+
value = one(concat(
45+
data.google_service_account.cluster_service_account,
46+
google_service_account.cluster_service_account
47+
))
4548
}

0 commit comments

Comments
 (0)