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

Unable to create additional cluster security group rules #1737

Closed
johngmyers opened this issue Jan 5, 2022 · 3 comments · Fixed by #1738
Closed

Unable to create additional cluster security group rules #1737

johngmyers opened this issue Jan 5, 2022 · 3 comments · Fixed by #1738

Comments

@johngmyers
Copy link

Description

Attempting to specify cluster_security_group_additional_rules results in a "Inconsistent conditional result types" error from Terraform.

Versions

  • Terraform: v1.0.0
  • Provider(s):
  • provider registry.terraform.io/hashicorp/aws v3.64.0
  • provider registry.terraform.io/hashicorp/cloudinit v2.2.0
  • provider registry.terraform.io/hashicorp/kubernetes v2.5.0
  • provider registry.terraform.io/hashicorp/local v2.1.0
  • provider registry.terraform.io/hashicorp/tls v3.1.0
  • provider registry.terraform.io/terraform-aws-modules/http v2.4.1
  • Module: 18.0.0

Reproduction

Steps to reproduce the behavior:

Add cluster_security_group_additional_rules input to module. Run terraform plan.

Code Snippet to Reproduce

  cluster_security_group_additional_rules = {
    admin_access = {
      description = "Admin ingress to Kubernetes API"
      cidr_blocks = var.admin_access
      protocol    = "tcp"
      from_port   = 443
      to_port     = 443
      type        = "ingress"
    }
  }

Expected behavior

Additional rule to be added to the created cluster security group.

Actual behavior

Error: Inconsistent conditional result types
│ 
│   on .terraform/modules/eks/main.tf line 122, in resource "aws_security_group_rule" "cluster":
│  122:   for_each = local.create_cluster_sg ? merge(local.cluster_security_group_rules, var.cluster_security_group_additional_rules) : {}
│     ├────────────────
│     │ local.cluster_security_group_rules is object with 3 attributes
│     │ local.create_cluster_sg is true
│     │ var.cluster_security_group_additional_rules is map of object with 1 element
│ 
│ The true and false result expressions must have consistent types. The given expressions are object and object, respectively.
╵

Terminal Output Screenshot(s)

Additional context

local.cluster_security_group_rules should probably be a map instead of an object.

@johngmyers
Copy link
Author

Actually, it's probably the part after the : that needs to be a map.

@antonbabenko
Copy link
Member

This issue has been resolved in version 18.0.1 🎉

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants