terraform-oci-oke icon indicating copy to clipboard operation
terraform-oci-oke copied to clipboard

Inconsistent type in group_worker.tf conditional result

Open shb-mll opened this issue 2 years ago • 1 comments

the highlited text from Line37-line40 in group-workers.tf needs to be enclosed under a tolist() function to convert the true result expression to type list. Terraform is erroring out as there is type mismatch with the false expression of type list. can we add the tolist as below . Thanks!

  worker_policy_statements = var.create_iam_worker_policy ? tolist(concat(
    local.cluster_join_statements,
    local.worker_kms_volume_statements,
  )) : []

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

Terraform v1.3.9
on darwin_arm64
+ provider registry.terraform.io/hashicorp/cloudinit v2.3.2
+ provider registry.terraform.io/hashicorp/helm v2.9.0
+ provider registry.terraform.io/hashicorp/http v3.2.1
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/time v0.9.1
+ provider registry.terraform.io/oracle/oci v5.2.1

Your version of Terraform is out of date! The latest version
is 1.5.1. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

oci_identity_policy

Terraform Configuration Files

https://github.com/oracle-terraform-modules/terraform-oci-oke/blob/v5.0.0-beta.4/modules/iam/group-workers.tf

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. 
# Please remove any sensitive information from configuration files before sharing them. 

Debug Output

Panic Output

│ Error: Inconsistent conditional result types
│ 
│   on modules/iam/group-workers.tf line 37, in locals:
│   37:   worker_policy_statements = var.create_iam_worker_policy ? concat(
│   38:     local.cluster_join_statements,
│   39:     local.worker_kms_volume_statements,
│   40:   ) : []
│     ├────────────────
│     │ local.cluster_join_statements is list of string with 1 element
│     │ local.worker_kms_volume_statements is list of list of string with 3 elements
│     │ var.create_iam_worker_policy is false
│ 
│ The true and false result expressions must have consistent types. The
│ 'true' tuple has length 4, but the 'false' tuple has length 0.

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

shb-mll avatar Jun 26 '23 08:06 shb-mll

@shb-mll Thanks for reporting - can you give this another try with the latest when you get a chance to confirm resolution?

devoncrouse avatar Jun 27 '23 12:06 devoncrouse