Skip to content

The true and false result expressions must have consistent types. The 'true' value is set of dynamic, but the 'false' value is object. #31039

@FernandoMiguel

Description

@FernandoMiguel
$ terraform apply
╷
│ Warning: Experimental feature "module_variable_optional_attrs" is active
│
│   on .terraform/modules/base_system.eks_blueprints_kubernetes_addons_karpenter.ondat/locals.tf line 2, in terraform:
│    2:   experiments = [module_variable_optional_attrs]
│
│ Experimental features are subject to breaking changes in future minor or patch releases, based on feedback.
│
│ If you have feedback on the design of this feature, please open a GitHub issue to discuss it.
│
│ (and 63 more similar warnings elsewhere)
╵
╷
│ Warning: Redundant ignore_changes element
│
│   on .terraform/modules/base_system/eks_addons.tf line 62, in resource "aws_eks_addon" "aws_eks_addons":
│   62: resource "aws_eks_addon" "aws_eks_addons" {
│
│ Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured.
│
│ The attribute modified_at is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning.
╵
╷
│ Error: Inconsistent conditional result types
│
│   on .terraform/modules/base_system/otel-fargate-container-insights.tf line 15, in resource "kubectl_manifest" "otel_fargate_container_insights":
│   15:   for_each  = var.fargate_create == true && var.otel_fargate_container_insights_enabled == true ? toset(data.kubectl_path_documents.otel_fargate_container_insights[0].documents) : {}
│     ├────────────────
│     │ data.kubectl_path_documents.otel_fargate_container_insights[0].documents will be known only after apply
│     │ var.fargate_create is a bool, known only after apply
│     │ var.otel_fargate_container_insights_enabled is a bool, known only after apply
│
│ The true and false result expressions must have consistent types. The 'true' value is set of dynamic, but the 'false' value is object.
╵

Terraform Version

$ terraform -v
Terraform v1.2.0-rc2
on darwin_arm64
+ provider [registry.terraform.io/gavinbunney/kubectl](http://registry.terraform.io/gavinbunney/kubectl) v1.14.0
+ provider [registry.terraform.io/hashicorp/aws](http://registry.terraform.io/hashicorp/aws) v4.13.0
+ provider [registry.terraform.io/hashicorp/cloudinit](http://registry.terraform.io/hashicorp/cloudinit) v2.2.0
+ provider [registry.terraform.io/hashicorp/helm](http://registry.terraform.io/hashicorp/helm) v2.5.1
+ provider [registry.terraform.io/hashicorp/kubernetes](http://registry.terraform.io/hashicorp/kubernetes) v2.11.0
+ provider [registry.terraform.io/hashicorp/local](http://registry.terraform.io/hashicorp/local) v2.2.2
+ provider [registry.terraform.io/hashicorp/null](http://registry.terraform.io/hashicorp/null) v3.1.1
+ provider [registry.terraform.io/hashicorp/random](http://registry.terraform.io/hashicorp/random) v3.1.3
+ provider [registry.terraform.io/hashicorp/time](http://registry.terraform.io/hashicorp/time) v0.7.2
+ provider registry.terraform.io/hashicorp/vault v3.5.0

Terraform Configuration Files

data "kubectl_path_documents" "otel_fargate_container_insights" {
  count   = var.fargate_create == true && var.otel_fargate_container_insights_enabled == true ? 1 : 0
  pattern = "${path.module}/charts/otel-fargate-container-insights/*.yaml"
  vars = {
    ClusterName        = data.aws_eks_cluster.this.id
    namespace          = var.otel_fargate_container_insights_namespace
    ServiceAccountName = var.otel_fargate_container_insights_service_account_name
    region             = var.aws_region
  }
}

resource "kubectl_manifest" "otel_fargate_container_insights" {
  for_each  = var.fargate_create == true && var.otel_fargate_container_insights_enabled == true ? toset(data.kubectl_path_documents.otel_fargate_container_insights[0].documents) : {}
  yaml_body = each.value

  depends_on = [
    aws_iam_role.otel_irsa,
    kubernetes_namespace.otel_fargate_container_insights_namespace,
    kubernetes_service_account.eks_service_account_otel_fargate_container_insights,
    aws_cloudwatch_log_group.containerinsights,
  ]
}

works fine with

$ terraform -v
Terraform v1.1.9
on darwin_arm64
+ provider registry.terraform.io/gavinbunney/kubectl v1.14.0
+ provider registry.terraform.io/hashicorp/aws v4.13.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/helm v2.5.1
+ provider registry.terraform.io/hashicorp/kubernetes v2.11.0
+ provider registry.terraform.io/hashicorp/local v2.2.2
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.1.3
+ provider registry.terraform.io/hashicorp/time v0.7.2
+ provider registry.terraform.io/hashicorp/vault v3.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions