Terraform-provider-aws: panic: interface conversion: interface {} is nil, not map[string]interface {} in aws_config_config_rule

Created on 12 Sep 2018  ·  5Comments  ·  Source: hashicorp/terraform-provider-aws

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

Terraform v0.11.8

  • provider.aws v1.35.0
  • provider.null v1.0.0

Affected Resource(s)

  • aws_config_config_rule

Terraform Configuration Files

This is a simplified call to the resource which illustrates the problem. Basically, when the scope is presented with empty strings for the attributes, the provider panics and crashes Terraform. The use case for doing this is the embedding of the aws_config_rule_resource in a module (which I am doing), and allowing the module users to optionally specify a scope. Works great when the scope is specified, obviously not so great when it is not.

resource "aws_config_config_rule" "rule" {
  count             = "${var.rules_count}"
  depends_on        = [
    "aws_config_configuration_recorder.config"
  ]
  input_parameters  = "${lookup(var.input_parameters, element(var.rules, count.index), "")}"
  name              = "${element(var.rules, count.index)}"
  scope {
    tag_key = ""
    tag_value = ""
  }
  source {
    owner             = "AWS"
    source_identifier = "${lookup(local.source_identifiers, element(var.rules, count.index))}"
  }
}

Panic Output

crash.log

Expected Behavior

I believe that the aws_config_config_rule should treat empty strings in the scope attributes as if those attributes were never referenced.

Actual Behavior

panic

Steps to Reproduce

Simply try to create an aws_config_config_rule resources that references the tag_key and tag_value in scope, and supply those with empty strings. Then wait for the panic.

References

I couldn't find any.

bug crash servicconfigservice

Most helpful comment

The fix for this has been merged into master and will release with version 1.37.0 of the AWS provider, likely middle of next week. 👍

All 5 comments

Thanks for the report @joseph-wortmann and sorry you ran into trouble. Submitted a pull request to fix this crash that verifies the empty string configuration should work as expected afterwards: #5852

No need to apologize. Software has bugs. I'm a software guy too. Thank you for jumping on this so quickly!!!

The fix for this has been merged into master and will release with version 1.37.0 of the AWS provider, likely middle of next week. 👍

This has been released in version 1.37.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings