Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent conditional result types in kubernetes-engine_workload-identity output #1112

Open
psarka opened this issue Dec 13, 2021 · 3 comments
Labels
bug Something isn't working P2 high priority issues triaged Scoped and ready for work

Comments

@psarka
Copy link

psarka commented Dec 13, 2021

TL;DR

Terraform chokes with Error: Inconsistent conditional result types when trying to compute gcp_service_account output in workload-identity/output.tf.

Expected behavior

No response

Observed behavior

The full error message is:

paulius@xps:~/Documents/gcloud-infrastructure/terraform_v2$ terraform apply
╷
│ Error: Inconsistent conditional result types
│ 
│   on .terraform/modules/kubernetes-engine_workload-identity/modules/workload-identity/output.tf line 44, in output "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]
│     ├────────────────
│     │ data.google_service_account.cluster_service_account[0] is a object, known only after apply
│     │ google_service_account.cluster_service_account[0] is a object, known only after apply
│     │ var.use_existing_gcp_sa is a bool, known only after apply
│ 
│ The true and false result expressions must have consistent types. The given expressions are object and object, respectively.

Terraform Configuration

module "kubernetes-engine_workload-identity" {
  source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity"
  name = "mlflow-worker"
  namespace = "default"
  version = "17.2.0"
  project_id = var.project
  roles = [
    "roles/artifactregistry.reader",
    "roles/storage.objectAdmin",
  ]
}


### Terraform Version

```sh
Terraform v1.1.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/external v2.1.0
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/google-beta v4.3.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.7.1
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

Additional information

It did work initially, when I created the cluster, and I'm not sure what happened since then. I'm pretty sure I did not upgrade anything.

When I got this bug, I did reinit terraform, with no positive effect. My current workaround is to manually edit the .terraform/modules/kubernetes-engine_workload-identity/modules//workload-identity/output.tf file and replace line 44 by value = google_service_account.cluster_service_account[0].

@psarka psarka added the bug Something isn't working label Dec 13, 2021
@pawlomi
Copy link

pawlomi commented Dec 13, 2021

I have noticed the same issue.
It is ok when using Terraform v1.0.11 but fails with Terraform v1.1.0

@morgante
Copy link
Contributor

Interesting, seems like a change in Terraform v1.1.0. We might have to use a data source in both cases or construct an object with an overlapping subset of the fields.

@morgante morgante added P2 high priority issues triaged Scoped and ready for work labels Dec 13, 2021
@D3luxee
Copy link

D3luxee commented Dec 17, 2021

Terraform 1.1.1 was released yesterday which fixed this issue.

https://github.com/hashicorp/terraform/releases/tag/v1.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 high priority issues triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

4 participants