hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.57k stars 9.54k forks source link

[crash] Bug using variable with 'any' type #24652

Closed fernando1989mg closed 4 years ago

fernando1989mg commented 4 years ago

crash.log

Terraform Version

Terraform v0.12.24
+ provider.aws v2.54.0
+ provider.local v1.4.0
+ provider.template v2.1.2

Terraform Configuration Files

/*in variables.tf*/
variable "rules" {
  type = map(object({
    listener_key = string,
    priority = number,
    tg_key = string,
    path_pattern = list(string),
    filter_ip = list(string),
    http_header = any
  }))
}

/*in provider.tf, the module declaration....*/
      ruleTwilioLogger = {
          listener_key = "listener_https",
          priority = 9
          tg_key = "tgTwilioLogs"
          path_pattern = ["/twilio-logger/*"]
          filter_ip = null
          http_header = {http_header_name = "ApiGatewayAuth", values = ["Asf1234$.@"]}
      },
      ruleScheduling = {
          listener_key = "listener_https",
          priority = 10
          tg_key = "tgScheduling"
          path_pattern = ["/scheduling/*"]
          filter_ip = null
          http_header = []
      },

/*in main.tf, the module code....*/
  dynamic "condition" {
    for_each = each.value.http_header
    content {
        http_header {
          http_header_name = condition.value["http_header_name"]
          values           = condition.value["values"]
        }
    }
  }

Debug Output

Crash Output

https://raw.githubusercontent.com/fernando1989mg/uploadsPublics/master/crash.log

Expected Behavior

I understand that the type of variable any should accept any value, so that should happen, that accept the values provided

Actual Behavior

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform. A crash log has been placed at "crash.log" relative to your current working directory. It would be immensely helpful if you could please report the crash with Terraform1 so that we can fix this.

When reporting bugs, please include your terraform version. That information is available on the first line of crash.log. You can also get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.log" file that was created may contain sensitive information that must be redacted before it is safe to share on the issue tracker.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Steps to Reproduce

Additional Context

References

danieldreier commented 4 years ago

Hi @fernando1989mg! Thanks for reporting this. This looks like a valid issue report. Based on the context you've provided, I have some clues about what might be causing it, but not quite enough of a reproduction case to just run locally and reproduce the crash.

If you can, it would really help if you could provide a minimal full example, for example in a tiny github repository, that I could clone and run locally. Ideally, this would use the null resource to reduce test dependencies. Is that something you can help add in?

techdragon commented 4 years ago

Not the original poster, but this appears to be similar if not the same as #23508 and #24801

jbardin commented 4 years ago

Thanks @techdragon, we can track this in #24801

ghost commented 4 years ago

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.